[arquillian-issues] [JBoss JIRA] (ARQGRA-216) Support protection from StaleElementReferenceException

Jan Papousek (JIRA) jira-events at lists.jboss.org
Tue Oct 23 07:35:01 EDT 2012


    [ https://issues.jboss.org/browse/ARQGRA-216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12728568#comment-12728568 ] 

Jan Papousek commented on ARQGRA-216:
-------------------------------------

The behaviour with StaleElementReferenceException occurs only when manipulating with lists. List itself is proxy, so it loads new elements whenever any its method invocation, but elements in the list aren't proxies.

The following example produces StaleElementReferenceException:
{code}
@FindBy(...)
List<WebElement> elements;
.
.
.
for (WebElement e: elements) {
    // an action changing DOM
    e.click();
    // element reference is stale
    System.out.println(e.getText());
}
{code}

The following code doesn't produce StaleElementReferenceException:
{code}
@FindBy(...)
List<WebElement> elements;
.
.
.
int size = elements.size();
for (int i=0; i<size; i++) {
    // an action changing DOM
    elements.get(i).click();
    // new element reference is used
    System.out.println(elements.get(i).getText());
}
{code}
                
> Support protection from StaleElementReferenceException
> ------------------------------------------------------
>
>                 Key: ARQGRA-216
>                 URL: https://issues.jboss.org/browse/ARQGRA-216
>             Project: Arquillian Graphene
>          Issue Type: Feature Request
>          Components: core, ftest
>    Affects Versions: 2.0.0.Alpha3
>            Reporter: Juraj Húska
>            Assignee: Jan Papousek
>             Fix For: 2.0.0.Alpha3
>
>
> When interacting with the {{WebElement}} which was retrieved before a DOM update there is {{StaleElementReferenceException}} thrown.
> Possible solution for this is to use something [StaleReferenceAwareFieldDecorator|https://github.com/richfaces/qa/blob/master/common/webdriver-utils/src/main/java/org/jboss/test/selenium/support/pagefactory/StaleReferenceAwareFieldDecorator.java].

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the arquillian-issues mailing list