views:

365

answers:

3

I'm testing a richfaces application with selenium. It works fine, unless I use reRender. (for those unfamiliar with richfaces - whenever an ajax request finished, parts of the DOM are updated/chagned/removed).

So, after a reRender selenium (the IDE at least) fails to locate the elements which were within the reRendered area. Both FireBug and WebDeveloper locate the elements, and on "view source" the elements are there.

So, is there a way to tell selenium to update its DOM "knowledge" with the latest changes?

Firefox 3.5.6, latest version of Selenium IDE.

+1  A: 

Selenium doesn't keep a cached version of the DOM. It can't because it is using JavaScript and all javascript DOM queries are always live.

What are you using to find the elements? If you are using Xpath/CSS selectors then there is a chance that the XPath is no longer valid or the CSS selector may not be correct.

AutomatedTester
I'm using XPath. The XPath is valid for an item before the reRender, and is invalid for the same item after the reRender. Using WebDeveloper I track the actual path to the object, and the XPath within selenium IDE doesn't seem to find the elements that certainly exist there.
Bozho
can you put a code snippet of the markup before and after the rerender for the item that you want. If you are moving down a tree then add that too. It will help me help you with a more robust selector
AutomatedTester
I'll be able to do it tomorrow. I tried to most concrete selector - following children from body, one level down each time, clicking 'find'. At the point I reach the reRendered area, the items that WebDeveloper shows cannot be located using the XPath in Selenium IDE. Furthermore - when I click at that location in "record" mode and the area is rerendered, the IDE places "INVALID_LOCATOR_.." (or smth like that), while if I do this before reRender, it puts a correct locator. So I'm pretty sure this is aither a bug or I should somehow tell it to refresh its cache. But I don't know how.
Bozho
A: 

I'm experiencing the same problem. Is there any solution to this?

Best regards Tor Åge Ballo

Tor Åge Ballo
you should add this as a comment. No, there is no solution yet.
Bozho
+1  A: 

I'm using Fifefox 3.6.8, Selenium IDE 1.0.7, and RichFaces 3.3.1, running on Ubuntu Linux. I don't have this problem.

I have a simple form where the selection of a radio button triggers a reRender of an a:outputPanel. Initially, the panel is empty. If the right radio button is selected, the rendered condition is met, and the panel is rerendered with its children components. I am able to set a waitForCondition to look for an element id that will appear as a child of the panel, and I am able to verify the child elements after they appear. Selenium IDE correctly identifies these child elements when I right click in Firefox.

T Bryan
so perhaps they fixed it in 1.0.7.
Bozho