While trying to use Selenium on Chrome to interact with QWOP, an error message consistently appears:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element {"method":"id","selector":"window1" (Session info: chrome=63.0.3239.108 (Driver info: chromedriver=2.34.522913
The "NoSuchElementException" is raised because the provided locator, id, fails to uniquely identify the desired element.
To resolve the issue, replace the locator with one that uniquely identifies the canvas element:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//canvas[@id='window1']"))).click()
The above is the detailed content of Why Does Selenium Throw a 'NoSuchElementException' When Locating Elements in Chrome?. For more information, please follow other related articles on the PHP Chinese website!