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

find_element_by_* commands are deprecated in Selenium

This error message… DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead …implies that the find_element_by_* commands are deprecated in the latest Selenium Python libraries. As AutomatedTester mentions: This DeprecationWarning was the reflection of the changes made with respect to the decision to simplify the APIs across the languages and this does that. Solution Instead … Read more

WebDriver executeAsyncScript vs executeScript

(Keeping it simple, and correct.) The relevant difference between execteScript and executeAsyncScript is this: The function invoked with executeAsyncScript takes a ‘done callback’ as the last argument, which must be called to signal that the script is done executing. This allows it to be used with code that only ‘finishes’ when a callback is used … Read more

org.openqa.selenium.ElementNotInteractableException: Element is not reachable by keyboard: while sending text to FirstName field in Facebook

ElementNotInteractableException: Element is not reachable by keyboard Element is not reachable by keyboard in plain words means that the element can’t be reached using the keyboard, which means you won’t even physically interact with it. Reason There can be multiple reasons behind the error Element is not reachable by keyboard which can be either of … Read more

Locating child nodes of WebElements in selenium

According to JavaDocs, you can do this: WebElement input = divA.findElement(By.xpath(“.//input”)); How can I ask in xpath for “the div-tag that contains a span with the text ‘hello world’”? WebElement elem = driver.findElement(By.xpath(“//div[span[text()=’hello world’]]”)); The XPath spec is a suprisingly good read on this.