Naveh Mevorach
Naveh Mevorach

Reputation: 31

Keep getting Unresolved reference 'By' in Selenium

im keep getting Unresolved reference 'By'

here is the code:

from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.indiegogo.com/explore/home?project_type=campaign&project_timing=all&sort=trending")
driver.implicitly_wait(0.5)
vegetable = driver.find_element(By.CSS_SELECTOR, "tomatoes")

here is an image: enter image description here

Upvotes: 0

Views: 1035

Answers (2)

George Imerlishvili
George Imerlishvili

Reputation: 1957

first you need to import By
from selenium.webdriver.common.by import By

whole code

from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://www.indiegogo.com/explore/home?project_type=campaign&project_timing=all&sort=trending")
driver.implicitly_wait(0.5)
vegetable = driver.find_element(By.CSS_SELECTOR, "tomatoes")

Upvotes: 1

uingtea
uingtea

Reputation: 6534

add the reference

from selenium.webdriver.common.by import By

Upvotes: 4

Related Questions