Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a web page that contains the HTML code:

<li class="spam sysfolder hasmultimsg allow-rclick has-unread selected" id="%40B%40Bulk" data-fid="%40B%40Bulk" data-ftype="spam"> <a role="link" tabindex="0" aria-selected="true" class="x-gap btn btn-spam" data-action="navigate" title="Spam - 19 emails" href="#" aria-label="Spam 19 unread" id="yui_3_16_0_ym19_1_1495273919709_3026"> <span role="link" id="spam-label" class="icon-text foldername">Spam</span> <span id="spam-count" class="unread-count " title="19 unread emails">(19)</span> <span class="rht"> <span class="btn icon icon-delete" id="btn-emptyspam" data-action="folder-empty-spam" title="Empty the Spam folder"> </span> </span> </a></li>

I have a test case in which I must find the WebElement with id
yui_3_16_0_ym19_1_1495273919709_3026

What I have tried:

driver.findElement(By.Id("yui_3_16_0_ym19_1_1495273919709_3026"));

But the console error is:

stale element reference: element is not attached to the page document
  (Session info: chrome=58.0.3029.110)
  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.14393 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 24 milliseconds
Posted
Updated 4-Jun-17 9:21am
Comments
Valery Possoz 25-May-17 17:45pm    
I guess you are trying to write a selenium test on a yahoo mail page or something ... It's full of scripts! This error means that the element does not exist or has changed or does not yet exist. It's probably due to a script.

See here : http://www.seleniumhq.org/exceptions/stale_element_reference.jsp

1 solution

No, I have problems only to id. For other selectors my WebElement exists.

I use xpath and I resolved problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900