Skip to content

Conversation

@Sachin-NK
Copy link
Contributor

  • Added is_valid_url() function: Uses urllib.parse.urlparse to validate URL format, ensuring it includes a valid scheme and network location.
  • Added sanitize_locator() function: Sanitizes element locators using a regular expression to remove potentially harmful characters, allowing only alphanumeric characters, periods, hash symbols, and square brackets.
  • Modified scrape_website() function: Now uses the is_valid_url() function to validate user-provided URLs and the sanitize_locator() function to sanitize element locators before use. Improved input prompts to guide users.

- Added `is_valid_url()` function: Uses `urllib.parse.urlparse` to validate URL format, ensuring it includes a valid scheme and network location.
- Added `sanitize_locator()` function: Sanitizes element locators using a regular expression to remove potentially harmful characters, allowing only alphanumeric characters, periods, hash symbols, and square brackets.
- Modified `scrape_website()` function:  Now uses the `is_valid_url()` function to validate user-provided URLs and the `sanitize_locator()` function to sanitize element locators before use.  Improved input prompts to guide users.
@sunny7899
Copy link
Member

@Ki1er Can you resolve the code conflict please

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Input Validation for Website URL and Element Locator

2 participants