Is it due to the site himself? If it is the case, how to bypass the problem?
I tried to make the web driver wait, but it didn't help...
This is my code :
from selenium import webdriver
PATH = '/Users/xxxx/chromedriver'
driver = webdriver.Chrome(PATH)
driver.get('https://haveibeenpwned.com/')
e_mail = driver.find_element_by_id('Account')
e_mail.send_keys('[email protected]')
login_button = driver.find_element_by_id('searchPwnage')
login_button.click()
response = driver.find_element_by_id('pwnCount')
print(response.text)
What can I do ?
CodePudding user response:
Try
from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
driver.get('https://haveibeenpwned.com/')
e_mail = driver.find_element_by_id('Account')
CodePudding user response:
In order to make chromedriver to stay open, you have to use the detach option when starting the chromedriver.
As the following:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
