Skip to content

add selenium tasks#2

Open
ashu-011 wants to merge 2 commits intomainfrom
code_rabbit
Open

add selenium tasks#2
ashu-011 wants to merge 2 commits intomainfrom
code_rabbit

Conversation

@ashu-011
Copy link
Copy Markdown
Owner

@ashu-011 ashu-011 commented Jun 21, 2025

Summary by CodeRabbit

  • New Features
    • Introduced an automated workflow that performs advanced repository searches on GitHub and validates search results, including repository details and README content.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 21, 2025

Walkthrough

A new script was introduced to automate browser interactions with GitHub using Selenium WebDriver and Chrome. The script performs searches, applies advanced filters, verifies navigation steps and results, locates a specific repository, and fetches part of its README file, with assertions at key points to ensure correctness.

Changes

File(s) Change Summary
main.yaml Added a Selenium-based automation script for GitHub search, advanced filters, repository validation, and README retrieval.

Poem

A bunny hopped to GitHub’s door,
With Selenium paws, it did explore.
It searched for "react," then filtered with care,
For stars, followers, and licenses rare.
It found "decider" with a joyful squeal,
And nibbled README bytes for its meal!
🐇💻✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (10)
main.yaml (10)

1-1: Remove unused import or utilize logging
logging is imported but never used. Either remove it or replace print calls with logging.info().


17-18: Improve search URL assertion & fix typo

  • The URL may include extra parameters; use startswith for robustness.
  • Correct typo (URlURL).
- assert "https://github.com/search?q=react" in driver.current_url , "search operation failed as current URl doesn't match"
+ expected_prefix = "https://github.com/search?q=react"
+ assert driver.current_url.startswith(expected_prefix), f"Search URL mismatch: {driver.current_url}"

23-24: Update dropdown locator & add wait
Switch to find_element(By.ID, …) with WebDriverWait to ensure the dropdown is present.

- dropdown=Select(driver.find_element_by_id("search_language"))
- dropdown.select_by_visible_text("JavaScript")
+ dropdown_el = WebDriverWait(driver, 10).until(
+     EC.presence_of_element_located((By.ID, "search_language"))
+ )
+ dropdown = Select(dropdown_el)
+ dropdown.select_by_visible_text("JavaScript")

26-32: Refactor filter inputs with waits & modern locator API

  • Consolidate setting stars, followers, and license filters in a loop.
  • Replace deprecated locators with By.ID and use WebDriverWait before interacting.
- for field_id, value in [("search_stars", ">45"), ("search_followers", ">50"), ("search_license", "Boost Software License 1.0")]:
-     driver.find_element_by_id(field_id).send_keys(value)
+ for field_id, value in [("search_stars", ">45"), ("search_followers", ">50"), ("search_license", "Boost Software License 1.0")]:
+     el = WebDriverWait(driver, 10).until(
+         EC.presence_of_element_located((By.ID, field_id))
+     )
+     el.clear()
+     el.send_keys(value)

34-34: Update submit button click with locator API & wait
Replace find_element_by_xpath with find_element(By.XPATH, …) and wait for clickability.

- driver.find_element_by_xpath('//button[contains(@class,"flex-auto btn")]').click()
+ submit_btn = WebDriverWait(driver, 10).until(
+     EC.element_to_be_clickable((By.XPATH, '//button[contains(@class,"flex-auto btn")]'))
+ )
+ submit_btn.click()

35-38: Fix result variable typo & improve parsing

  • Rename respository_resultrepository_result.
  • Use a CSS selector with an explicit wait.
- respository_result=(driver.find_element_by_xpath('//div[contains(@class,"pb-3")]').text)
- print("Repository result shown : {}".format(respository_result))
+ repository_result = WebDriverWait(driver, 10).until(
+     EC.presence_of_element_located((By.CSS_SELECTOR, 'div.pb-3'))
+ ).text
+ print(f"Repository result shown: {repository_result}")

40-46: Enhance repository search logic & update locators

  • Use find_elements(By.CSS_SELECTOR, …) with an explicit wait.
  • Handle the case where the target repo isn't found (for-else or explicit exception).
- repo_list=driver.find_elements_by_css_selector(".repo-list-item")
- for repo in repo_list:
-     if "mvoloskov/decider" in repo.text:
-         print("Correct Repository name found")
-         break
+ repo_items = WebDriverWait(driver, 10).until(
+     EC.presence_of_all_elements_located((By.CSS_SELECTOR, ".repo-list-item"))
+ )
+ for repo in repo_items:
+     if "mvoloskov/decider" in repo.text:
+         print("Correct Repository name found")
+         break
+ else:
+     raise AssertionError("Repository 'mvoloskov/decider' not found")

46-47: Wait for repository link & update locator
Replace find_element_by_link_text with find_element(By.LINK_TEXT, …) and wait until clickable.

- driver.find_element_by_link_text("mvoloskov/decider").click()
+ repo_link = WebDriverWait(driver, 10).until(
+     EC.element_to_be_clickable((By.LINK_TEXT, "mvoloskov/decider"))
+ )
+ repo_link.click()

47-49: Refactor raw file fetch & avoid shadowing built-in

  • Rename file to response (or readme_file) to avoid shadowing.
  • Use a context manager and handle HTTP errors, logging failures.
- url="https://raw.githubusercontent.com/mvoloskov/decider/master/README.md"
- file = urllib.request.urlopen(url)
- print(file.read(300))
+ url = "https://raw.githubusercontent.com/mvoloskov/decider/master/README.md"
+ try:
+     with urllib.request.urlopen(url) as response:
+         content = response.read(300)
+     print(content)
+ except Exception as e:
+     logging.error(f"Failed to fetch README: {e}")
+     raise

1-51: Ensure proper WebDriver teardown
Wrap the Selenium logic in a try/finally to guarantee driver.quit() is called, preventing orphaned browser instances.

Example pattern:

try:
    # existing Selenium tasks…
finally:
    driver.quit()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a5b008 and 2306de3.

📒 Files selected for processing (1)
  • main.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
main.yaml

[error] 9-9: syntax error: expected '', but found ''

(syntax)

Comment thread main.yaml
@@ -0,0 +1,50 @@
import logging
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

File extension mismatch leading to YAML syntax error
The file is named main.yaml but contains Python code, triggering a YAML lint error (expected '<document start>'). Rename it to main.py so the extension matches its content.

- main.yaml
+ main.py

Also applies to: 9-9

🤖 Prompt for AI Agents
In main.yaml at line 1 and also line 9, the file extension is .yaml but the
content is Python code, causing YAML syntax errors. Rename the file from
main.yaml to main.py to match the Python code inside and avoid linting issues.

Comment thread main.yaml Outdated
Comment thread main.yaml
from selenium import webdriver
from selenium.webdriver.support.select import Select

driver=webdriver.Chrome(executable_path="C:\\chromedriver.exe")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update deprecated ChromeDriver initialization & adhere to PEP8
Replace the deprecated executable_path argument, use a Service object with webdriver-manager, and add spaces around =.

-from selenium import webdriver
+from selenium import webdriver
+from selenium.webdriver.chrome.service import Service
+from webdriver_manager.chrome import ChromeDriverManager

-driver=webdriver.Chrome(executable_path="C:\\chromedriver.exe")
+service = Service(ChromeDriverManager().install())
+driver = webdriver.Chrome(service=service)
🤖 Prompt for AI Agents
In main.yaml at line 6, the ChromeDriver initialization uses the deprecated
executable_path argument and lacks PEP8 spacing. Replace the executable_path
parameter by importing Service from selenium.webdriver.chrome.service and create
a Service object with the chromedriver path. Then pass this Service object to
webdriver.Chrome. Also, add spaces around the equals sign in the assignment to
conform to PEP8 style.

Comment thread main.yaml
Comment on lines +14 to +15
driver.find_element_by_id("not-found-search").send_keys("react")
driver.find_element_by_css_selector('button[class="btn"]').click()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix locator, update to Selenium 4 API & add explicit wait

  • The ID not-found-search is invalid on the homepage. Use By.NAME (q) or a stable selector.
  • Replace deprecated find_element_by_* calls with find_element(By, …) and wrap in WebDriverWait.
+from selenium.webdriver.common.by import By
+from selenium.webdriver.support.ui import WebDriverWait
+from selenium.webdriver.support import expected_conditions as EC

- driver.find_element_by_id("not-found-search").send_keys("react")
- driver.find_element_by_css_selector('button[class="btn"]').click()
+ search_box = WebDriverWait(driver, 10).until(
+     EC.element_to_be_clickable((By.NAME, "q"))
+ )
+ search_box.send_keys("react")
+ search_box.submit()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
driver.find_element_by_id("not-found-search").send_keys("react")
driver.find_element_by_css_selector('button[class="btn"]').click()
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
search_box = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.NAME, "q"))
)
search_box.send_keys("react")
search_box.submit()
🤖 Prompt for AI Agents
In main.yaml around lines 14 to 15, the locator using ID "not-found-search" is
invalid and the find_element_by_* methods are deprecated in Selenium 4. Replace
the locator with a stable selector such as By.NAME with value "q". Update the
code to use the new Selenium 4 syntax find_element(By.NAME, "q") and
find_element(By.CSS_SELECTOR, 'button.btn'). Wrap these calls in WebDriverWait
with expected_conditions to explicitly wait for the elements to be present
before interacting with them.

Comment thread main.yaml
Comment on lines +19 to +20
driver.find_element_by_link_text("Advanced search").click()
assert "https://github.com/search/advanced?q=react&type=Repositories" in driver.current_url , "landed on wrong URL"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use explicit wait & update Advanced Search locator

  • Replace find_element_by_link_text with find_element(By.LINK_TEXT, …) and wait until clickable.
  • Wait for the Advanced Search page to fully load before asserting the URL.
- driver.find_element_by_link_text("Advanced search").click()
- assert "https://github.com/search/advanced?q=react&type=Repositories" in driver.current_url , "landed on wrong URL"
+ adv_link = WebDriverWait(driver, 10).until(
+     EC.element_to_be_clickable((By.LINK_TEXT, "Advanced search"))
+ )
+ adv_link.click()
+ WebDriverWait(driver, 10).until(lambda d: "/search/advanced" in d.current_url)
+ assert "/search/advanced" in driver.current_url, "Advanced search page not loaded"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
driver.find_element_by_link_text("Advanced search").click()
assert "https://github.com/search/advanced?q=react&type=Repositories" in driver.current_url , "landed on wrong URL"
adv_link = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.LINK_TEXT, "Advanced search"))
)
adv_link.click()
WebDriverWait(driver, 10).until(lambda d: "/search/advanced" in d.current_url)
assert "/search/advanced" in driver.current_url, "Advanced search page not loaded"
🤖 Prompt for AI Agents
In main.yaml around lines 19 to 20, replace the deprecated
find_element_by_link_text with find_element using By.LINK_TEXT and add an
explicit wait to ensure the "Advanced search" link is clickable before clicking
it. After clicking, add a wait to confirm the Advanced Search page has fully
loaded before asserting the URL to avoid timing issues.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (4)
main.yaml (4)

1-1: File extension mismatch: Python code in YAML file
The file is named main.yaml but contains Python code, causing YAML lint errors. Rename the file to main.py to match its content.


6-6: Update deprecated ChromeDriver initialization & adhere to PEP8
Replace the deprecated executable_path argument with a Service object and use webdriver_manager for driver management. Also add spaces around = for PEP8 compliance.

-from selenium import webdriver
+from selenium import webdriver
+from selenium.webdriver.chrome.service import Service
+from webdriver_manager.chrome import ChromeDriverManager

-driver=webdriver.Chrome(executable_path="C:\\chromedriver.exe")
+service = Service(ChromeDriverManager().install())
+driver = webdriver.Chrome(service=service)

14-15: Fix deprecated locators and add explicit waits (Selenium 4)
Replace deprecated find_element_by_* calls and invalid ID selector. Use By.NAME with WebDriverWait, then submit:

-from driver.find_element_by_id("not-found-search").send_keys("react")
-from driver.find_element_by_css_selector('button[class="btn"]').click()
+search_box = WebDriverWait(driver, 10).until(
+    EC.element_to_be_clickable((By.NAME, "q"))
+)
+search_box.send_keys("react")
+search_box.submit()

19-20: Replace deprecated locator and add explicit wait for Advanced Search link
Use By.LINK_TEXT and wait until clickable, then assert URL:

-from driver.find_element_by_link_text("Advanced search").click()
+adv_link = WebDriverWait(driver, 10).until(
+    EC.element_to_be_clickable((By.LINK_TEXT, "Advanced search"))
+)
+adv_link.click()
+WebDriverWait(driver, 10).until(lambda d: "/search/advanced" in d.current_url)
-assert "https://github.com/search/advanced?q=react&type=Repositories" in driver.current_url , "landed on wrong URL"
+assert "/search/advanced" in driver.current_url, "Advanced search page not loaded"
🧹 Nitpick comments (3)
main.yaml (3)

33-38: Use explicit wait for results and correct misspelling
Wait for the result element to be visible and rename respository_result to repository_result:

-from respository_result=(driver.find_element_by_xpath('//div[contains(@class,"pb-3")]').text)
+repository_result = WebDriverWait(driver, 10).until(
+    EC.visibility_of_element_located((By.XPATH, '//div[contains(@class,"pb-3")]'))
+).text
-print("Repository result shown : {}".format(respository_result))
+print(f"Repository result shown : {repository_result}")
-print("Verifying correct number of repository shown")
-assert "1 repository result" in respository_result , "Incorrect number of repository result showing up"
+print("Verifying correct number of repository shown")
+assert "1 repository result" in repository_result, "Incorrect number of repository result showing up"

46-46: Use explicit wait and Selenium 4 API for clicking the repository link

-from driver.find_element_by_link_text("mvoloskov/decider").click()
+WebDriverWait(driver, 10).until(
+    EC.element_to_be_clickable((By.LINK_TEXT, "mvoloskov/decider"))
+).click()

47-50: Improve file fetch with error handling and context manager
Switch to using a context manager and catch potential URL errors:

-from url="https://raw.githubusercontent.com/mvoloskov/decider/master/README.md"
-from file = urllib.request.urlopen(url)
-print(file.read(300))
+url = "https://raw.githubusercontent.com/mvoloskov/decider/master/README.md"
+try:
+    with urllib.request.urlopen(url) as response:
+        print(response.read(300))
+except urllib.error.URLError as e:
+    logging.error(f"Failed to fetch README: {e}")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2306de3 and 855c70c.

📒 Files selected for processing (1)
  • main.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
main.yaml

[error] 9-9: syntax error: expected '', but found ''

(syntax)

🔇 Additional comments (4)
main.yaml (4)

2-5: Standard imports (logging, urllib.request, selenium, Select) look appropriate.


8-13: Initial navigation, title assertion, and prints are straightforward.


16-18: URL verification and print look correct.


21-22: Section header and comments for dropdown handling are fine.

Comment thread main.yaml
Comment on lines +39 to +45
#verifying Repository name
repo_list=driver.find_elements_by_css_selector(".repo-list-item")
print(repo_list)
for repo in repo_list:
if "mvoloskov/decider" in repo.text:
print("Correct Repository name found")
break
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhance repository search with waits, new API & assertion
Use explicit waits, update to find_elements(By.CSS_SELECTOR, ...), and ensure failure if repo not found:

-from repo_list=driver.find_elements_by_css_selector(".repo-list-item")
+repo_list = WebDriverWait(driver, 10).until(
+    EC.presence_of_all_elements_located((By.CSS_SELECTOR, ".repo-list-item"))
+)
 for repo in repo_list:
     if "mvoloskov/decider" in repo.text:
         print("Correct Repository name found")
         break
+else:
+    raise AssertionError("Repository 'mvoloskov/decider' not found in results")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#verifying Repository name
repo_list=driver.find_elements_by_css_selector(".repo-list-item")
print(repo_list)
for repo in repo_list:
if "mvoloskov/decider" in repo.text:
print("Correct Repository name found")
break
#verifying Repository name
repo_list = WebDriverWait(driver, 10).until(
EC.presence_of_all_elements_located((By.CSS_SELECTOR, ".repo-list-item"))
)
print(repo_list)
for repo in repo_list:
if "mvoloskov/decider" in repo.text:
print("Correct Repository name found")
break
else:
raise AssertionError("Repository 'mvoloskov/decider' not found in results")
🤖 Prompt for AI Agents
In main.yaml around lines 39 to 45, replace the deprecated
find_elements_by_css_selector with find_elements using the By.CSS_SELECTOR
locator. Add an explicit wait to ensure the repository list is loaded before
searching. After the loop, add an assertion to fail the test if the repository
"mvoloskov/decider" is not found, ensuring the check is reliable and uses the
updated Selenium API.

Comment thread main.yaml
Comment on lines +23 to +32
dropdown=Select(driver.find_element_by_id("search_language"))
dropdown.select_by_visible_text("JavaScript")
#stars: >45;
driver.find_element_by_id("search_stars").send_keys(">45")

#followers: > 50;
driver.find_element_by_id("search_followers").send_keys(">50")

#license : Boost Software License 1.0
driver.find_element_by_id("search_license").send_keys("Boost Software License 1.0")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update to Selenium 4 API & add explicit waits for filter fields
Replace find_element_by_id with By.ID and wrap interactions in WebDriverWait:

-from dropdown=Select(driver.find_element_by_id("search_language"))
+dropdown = Select(WebDriverWait(driver, 10).until(
+    EC.presence_of_element_located((By.ID, "search_language"))
+))
 dropdown.select_by_visible_text("JavaScript")
 
-from driver.find_element_by_id("search_stars").send_keys(">45")
+WebDriverWait(driver, 10).until(
+    EC.presence_of_element_located((By.ID, "search_stars"))
+).send_keys(">45")
 
-from driver.find_element_by_id("search_followers").send_keys(">50")
+WebDriverWait(driver, 10).until(
+    EC.presence_of_element_located((By.ID, "search_followers"))
+).send_keys(">50")
 
-from driver.find_element_by_id("search_license").send_keys("Boost Software License 1.0")
+WebDriverWait(driver, 10).until(
+    EC.presence_of_element_located((By.ID, "search_license"))
+).send_keys("Boost Software License 1.0")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
dropdown=Select(driver.find_element_by_id("search_language"))
dropdown.select_by_visible_text("JavaScript")
#stars: >45;
driver.find_element_by_id("search_stars").send_keys(">45")
#followers: > 50;
driver.find_element_by_id("search_followers").send_keys(">50")
#license : Boost Software License 1.0
driver.find_element_by_id("search_license").send_keys("Boost Software License 1.0")
dropdown = Select(WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "search_language"))
))
dropdown.select_by_visible_text("JavaScript")
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "search_stars"))
).send_keys(">45")
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "search_followers"))
).send_keys(">50")
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "search_license"))
).send_keys("Boost Software License 1.0")
🤖 Prompt for AI Agents
In main.yaml around lines 23 to 32, the code uses the deprecated Selenium 3
method find_element_by_id. Update these calls to use the Selenium 4 syntax with
By.ID. Additionally, wrap each element interaction with WebDriverWait to
explicitly wait for the elements to be present before interacting with them.
This involves importing By and WebDriverWait, then replacing direct
find_element_by_id calls with waits that locate elements by ID before sending
keys or selecting options.

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.

1 participant