java - StaleElementReferenceException: stale element reference: -


I need to use the folder id from the code:

  {"folderType" : 3, "Folder": "02.09.2014 11: 57: 28.UTC", "Revised Date": "02.09.2014 11: 57: 28.UTC", "Folder Name": "Enterprise", "Folder ID": "Baebc0fb- 38cb-4300-9bd1-9b98fa622e4a", "widgettype": blank, "enterprise id": "366fc1f1-670d-41bc-905e-bc80accd2537", "parentfolder id": "",} {"folder type": 3 , "Date Created": "02.09.2014 11: 57: 28.UTC", "Revised Date": "02.09.2014 11: 57: 28.UTC", "Folder Name": "Submit", "Folder D ":" 6671c49-9637-488e-9a0e -f7dbf415a542 "," widgetType ": null," enterpriseId ":" 366fc1f1-670d-41bc-905e-bc80accd2537 "," parentFolderId ":" ",}  < / Pre> 

I need to access the folder of 'Enterprise' and 'Enter' folder.

This is my code:

string s1 = driver.findElement (By.xpath ("// span [. = '\" Enterprise \ "'] / ancestor :: pre / Following-sibling :: pre [1] / span [2] ")). GetText ();

  string s2 = driver.findElement (By.xpath ("// span [. = '\" Enter \ "'] / ancestor :: ex / low-brother :: east [ 1] / span [2] ")) gettext () .;   

I want to print the values ​​of string S1 and s2 without coat. I can enter the 'Enterprise' folder, but unable to access the 'Enter' folderId as the 'Enter' folder IID is the newly created folder.

For each field present between the coat, the following general form is HTML code:

  & lt; Pre & gt; & Lt; Span class = "cm-string" & gt; "Folder name" & lt; / span & gt;: & lt; Span class = "cm-string" & gt; "Enter" & lt; / span>, & lt; / Pre & gt; & Lt; Pre & gt; & Lt; Span class = "cm-string" & gt; "FolderId" & lt; / Span & gt;: & lt; Span class = "semi-string" & gt; "6671ca49-9637-488e-9a0e-f7dbf415a542" & lt; / Span & gt; & Lt; / Pre & gt;   

I can enter the folder using the Chrome Developer Tool like this:

  $ x ("// span [. = '\" Enter \ "'] / ancestor :: pre / following-sibling :: east [1] / period [2]") [& lt; Duration class = a "semi-string"> a ???? 6671ca49-9637-488e-9a0e-f7dbf415a542 "A" ??? / Lt; / Span & gt; One ????] Actual output in eclipse: the exception in the "main" organization: openqa.selenium.StaleElementReferenceException: stale element reference: element is not related to document page document (session's Info: Chrome = 37.0.2062.124) 

StaleElementReferenceException of unavailability of an element Reasons findelement () are used by the method.

  Private Static Web Element Search Element (by WebDriver Driver, Locator)  

Use the sample code below to wait for the element's visibility: Lt; WebDriver & gt; Wait = New FluentWit & lt; WebDriver & gt; (Driver) .withTimeout (90, Time Unit, SEOCNDS) .Polling every (5, time USNET.Secandds). Inning (no. Wait for wait. Ultimately (Expected conditions. Visibility, location locator);}



Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -