I am new to selenium whenever I try to find elements using id
, name
, xpath
or anything it gives the same error
from selenium import webdriver
driver = webdriver.Safari()
driver.get('https://www.lambdatest.com/blog/selenium-safaridriver-macos/')
driver.find_element(By.Link_Text,'Webinar' )
It shows error by underlining By. I tried writing
driver.find_element_by_id('Webinar')
But it does not go through I tried different websites and with different elements like class, id but seems like there is a problem with finding elements by any method is there something that needs to installed to make it work?
This
should be
Also, Import this
from selenium.webdriver.common.by import By
If you are on Selenium4 then you should not really use:
use this instead:
If you take a look at the source code, you'd see: