Issue
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService`
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))
driver.get('https://www.adamchoi.co.uk/overs/detailed')
all_matches_button = driver.find_element(By.XPATH, "//label[@analytics-event='All matches']")
all_matches_button.click()
# driver.quit()
- selenium version = 4.9.1
- python version = 3.11.3
I don't understand what's the problem. If anyone understand the problem please fix this.
Any help would be much appreciated
Solution
That occurs because chrome automatically closes when the code has finished running.
You might wanna use the following script for testing:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService`
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))
driver.get('https://www.adamchoi.co.uk/overs/detailed')
all_matches_button = driver.find_element(By.XPATH, "//label[@analytics-event='All matches']")
all_matches_button.click()
input("Press ENTER to quit")
driver.quit()
Note: You'll still want to execute driver.quit
in the end, as the temporary folder in your filesystem gets flooded elsewise
Answered By - kaliiiiiiiii
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.