staleelementreferenceexception

Selenium: How to tell if RemoteWebDriver.findElements(By) can throw StaleElementReferenceException at all?

回眸只為那壹抹淺笑 提交于 2019-11-26 21:10:53
In my understanding such exception can be thrown only if the code operates on a WebElement instance, calling methods on it after the corresponding DOM element has been reloaded or removed. So in order to find out if RemoteWebDriver.findElements(By) can throw that exception or not I looked for that kind of code in the source of the RemoteWebDriver implementation of WebDriver interface (in selenium-remote-driver-3.8.1.jar ). But following the call stacks deep down into RemoteWebDriver 's code eventually became too difficult for me. So my question is: besides trying to figure that out by

Selenium Webdriver - Stale element exception when clicking on multiple dropdowns while HTML DOM doesn't change

◇◆丶佛笑我妖孽 提交于 2019-11-26 18:38:43
问题 I tried to automate a scenario, where the condition is that I have to select an option from drop down and then there's another dropown next to it, I have to click one option from next drop to enable to button . I tried with the code but it clicks only the first option,.And showing error as stale Element reference:element is not attached to the page document. Please help. Please let me know if in not very clear. 回答1: When you select Insurance Test Client then only you get the option Product

Getting StaleElementReferenceException while trying print the link names

丶灬走出姿态 提交于 2019-11-26 17:51:56
问题 I'm trying to print first 5 pages links displayed in google search.. But getting StateElementReferenceException Not sure which one went wrong.. public class GoogleCoInTest { static WebDriver driver = null; public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.gecko.driver", "D:\\bala back up\\personel\\selenium\\Jars\\Drivers\\geckodriver.exe"); driver=new FirefoxDriver(); driver.manage().window().maximize(); driver.manage().timeouts()

StaleElementException when iterating with Python

穿精又带淫゛_ 提交于 2019-11-26 12:33:23
I'm trying to create a basic web scraper for Amazon results. As I'm iterating through results, I sometimes get to page 5 (sometimes only page 2) of the results and then a StaleElementException is thrown. When I look at the browser after the exception is thrown, I can see that the driver/page did not scroll down to where the page numbers are (bottom bar). My code: driver.get('https://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=sonicare+toothbrush') for page in range(1,last_page_number +1): driver.implicitly_wait(10) bottom_bar = driver.find_element_by_class_name(

StaleElementException when iterating with Python

与世无争的帅哥 提交于 2019-11-26 01:28:21
问题 I\'m trying to create a basic web scraper for Amazon results. As I\'m iterating through results, I sometimes get to page 5 (sometimes only page 2) of the results and then a StaleElementException is thrown. When I look at the browser after the exception is thrown, I can see that the driver/page did not scroll down to where the page numbers are (bottom bar). My code: driver.get(\'https://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=sonicare+toothbrush\') for page in

StaleElementReference Exception in PageFactory

一曲冷凌霜 提交于 2019-11-25 21:43:09
问题 I am trying to learn the PageFactory model. I understood the fact that when we do a initElements , the WebElements are located. Say for example, I click on a webelement and because of which there is a change in one of the other webelements in DOM. Now, obviously I would get a StaleElementReferenceException here. How would I resolve this issue? Should I find that specific WebElement again knowing the fact that there can be a change in the WebElement\'s properties in the DOM? or is there an