Note that there are some explanatory texts on larger screens.

plurals
  1. POStale reference exception for EventFiringWebDriver listener
    primarykey
    data
    text
    <p>I am getting Stale reference exception(Element no longer valid), I am using c# - Webdriver for automation.</p> <p>I am using Selenium for automation framework. In that I have used EventFiringWebDriver class of Selenium Event. that listens to every event of InterenetExplorerWebdriver (Like Click() or SendKeys()). In the events of the EventFiringWebDriver class like (ElementClicked,ElementValueChanged) I have implemented the logic that logs the WebElementEventArgs object's attributes to XML based log file. so at the end of the execution I can see the details of the execution of each test case in XSLT format and track functional errors.</p> <p>code:-</p> <pre><code>public class SeleniumEventListener : EventFiringWebDriver { public SeleniumEventListener(IWebDriver webDriver):base(webDriver) { ElementClicked += new EventHandler&lt;WebElementEventArgs&gt;SeleniumEventListener_ElementClicked); //more events handled here.. } void SeleniumEventListener_ElementValueChanged(object sender,WebElementEventArgs e) { LogPassedStep(e) } private LogPassedStep(e) { string title = e.Element.value; string status = "clicked" //XML based logging here. } </code></pre> <p>}</p> <p>In my application which I automate using selenium. I have some text boxes and Buttons, The EventFiringWebDriver class XMLLogging works correctly for the textboxes through out the test case execution But for the Buttons Or Links some of the times it Gives the "Element no longer valid" Stale reference exception(The some buttons are of the type Expand collapse which causes DOM to change, and In my application I have a Task page which refreshes at regular interval in that the Stale reference exception comes often)</p> <p>The Webdriver clicks works correctly throughout the execution but the EventFiringWebDriver fails to recognize the object and Stale reference exception comes</p> <p>Please help me.. or please suggest me the way to get that details of the webpage objects (like button,link) so that I can implement the Logging functionality(I am using C#-webdriver)/</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload