staleelementreferenceexception

Message: stale element reference: element is not attached to the page document

て烟熏妆下的殇ゞ 提交于 2019-12-25 03:16:57
问题 Im trying to automate a task we do almost daily. I read that python in combination with selenium would be perfect to approach this task. Any advice is welcome :) See my code below. from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC usernameStr = 'USERNAME' passwordStr = 'PASSWORD' browser = webdriver.Chrome() browser.get('https://www.partner.co.il/he

StaleElementReference Exception in PageFactory

瘦欲@ 提交于 2019-12-24 10:32:01
问题 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

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

谁都会走 提交于 2019-12-17 05:14:18
问题 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

org.openqa.selenium.StaleElementReferenceException: element is not attached to the page document while iterating through a List

那年仲夏 提交于 2019-12-11 16:15:10
问题 I don't know why this error shows up . Need help to fix it . Website i am working on :"http://freevideolectures.com/Course/3680/Pentaho-BI" . In this site List<WebElement> cl = d.findElements(By.xpath("//ul[@class='lecture_menu']/li/a")); System.out.println(cl.size()); for(int e=0 ; e<=cl.size()-1; e++) { cl.get(e).click();// i think the error shows up here, the loop runs for e=0 , Thread.sleep(1000); String q = d.findElement(By.xpath(".//*[@id='cs-about']/div/div[2]/div[2]/span/a"))

selenium fire StaleElementReferenceException

烂漫一生 提交于 2019-12-11 15:29:17
问题 i try to make a web crawler with selenium. My program fire a StaleElementReferenceException. I thought that were because i crawl a page recursive and when a page have no more links the function navigate to next page and not previously to the parent page. Therefore i have introduced a tree data structure to navigate back to the parent when the current url not equal the parent url. But this was not the solution for my problem. Can anybody help me? Code: public class crawler { private static

How to select an option from a dynamic dropdown using Selenium?

此生再无相见时 提交于 2019-12-10 17:47:01
问题 I am trying to click on dropdown value to select city in from field in Make my trip http://www.makemytrip.com/. But getting Stale element reference exception. Ids are getting changed on page load. Tried below code: driver.findElement(By.xpath(".//*[@id='hp-widget__sfrom']")).clear(); driver.findElement(By.xpath(".//*[@id='ui-id-1']")); driver.findElement(By.xpath(".//*[@id='hp-widget__sfrom']")).click(); WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions

Selenium assertFalse fails with staleelementreferenceexception

走远了吗. 提交于 2019-11-29 16:31:07
I have a selenium test in Java and I am doing some assertions like that: assertFalse(isElementPresent(By.xpath("//td[2]/div"))); private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } It´s the standard method Selenium is generating when export from IDE to Java Webdriver. (Yes I want to assert that this element is not present) I always get errors when I am testing at this above code line Error: stale element reference: element is not attached to the DOM But when I put a thread.sleep in front of that step it works

Getting StaleElementReferenceException while trying print the link names

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 09:49:14
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().implicitlyWait(10, TimeUnit.SECONDS); driver.get("https://www.google.co.in/"); //driver.findElement(By.xpath("/

Selenium assertFalse fails with staleelementreferenceexception

自作多情 提交于 2019-11-27 08:42:55
问题 I have a selenium test in Java and I am doing some assertions like that: assertFalse(isElementPresent(By.xpath("//td[2]/div"))); private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } It´s the standard method Selenium is generating when export from IDE to Java Webdriver. (Yes I want to assert that this element is not present) I always get errors when I am testing at this above code line Error: stale element

Message: stale element reference: element is not attached to the page document in Python

浪子不回头ぞ 提交于 2019-11-27 08:39:31
问题 I have been trying to run the following code in three different weblinks. Code works fine on one weblink. However, it throws an error message about "Message: stale element reference: element is not attached to the page document". I looked into forum's two previous threads (Python Selenium stale element fix and How to Navigate to a New Webpage In Selenium?) about the same error message but didn't get sort it out the issue. Here is my code: driver.get('https://github.com/avassalotti')