How to locate the button element using Selenium through Python
问题 I'm trying to find the element and click for the button "Not Now". I've tried with with css_selector, xpath, but I"m unable at all to find the proper way. HTML: 回答1: To locate and click() on the element with text as Not Now you can use the following Locator Strategy: Using xpath : driver.find_element_by_xpath("//button[text()='Not Now']").click() However, the element looks dynamic to me so you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the