lundi 19 juin 2017

Python Selenium Webdriver (name 'by' not defined)

I keep gettig the error: NameError: name 'By' is not defined

for the code

chrome_driver_path = r"C:\chromedriver.exe"
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
browser = webdriver.Chrome(chrome_driver_path)
browser.delete_all_cookies()
browser.get("https://www.google.com/")
wait = WebDriverWait(browser, 10)
element = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="tsf"]/div[2]/div[3]/center/input[1]')))  

Is my import correct?

Aucun commentaire:

Enregistrer un commentaire