selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:

Looks like it takes time to load the webpage, and hence the detection of webelement wasn’t happening. You can either use @shri’s code above or just add these two statements just below the code driver = webdriver.Firefox():

driver.maximize_window() # For maximizing window
driver.implicitly_wait(20) # gives an implicit wait for 20 seconds

Leave a Comment