Skip to content

Conversation

@SandeshNarayan
Copy link

This PR introduces utility functions to improve code reuse and maintainability. The changes include:

🔹 Changes Made:

  • create_directory(path: str) – Ensures the given directory exists before creating it.
  • capture_screenshot(driver, screenshot_path) – Captures a screenshot from the Selenium WebDriver and handles errors gracefully.
  • capture_html(driver, html_path) – Saves the current page's HTML source to a file with UTF-8 encoding.
  • join_paths(*paths) – A helper function to join multiple path segments securely.

Copy link
Owner

@GabeGiro GabeGiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good effort!

I added few comments and please follow the code style of the project for consistency, meaning capture_screenshot should be captureScreenshot

utils/file.py Outdated

import utils.logger as logger
from utils.logger import MessageTypes
from selenium.webdriver.remote.webdriver import WebDriver
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check other files to see how the webdriver is imported

utils/file.py Outdated
logger.logDebugMessage("Error in writeResults", logger.MessageTypes.ERROR, e)


def createDirectory(path : str):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, introducing code style inconsistency with spacing. Check other functions around the code and you'll understand

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing them out, really appreciate your review. I will make sure to not repeat these mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants