Can I tell Selenium to record in DOM mode instead of element ID mode?
I have been开发者_开发百科 using Selenium in my DEV environment. When I go to try some of my recorded tests on my Test environment, I find that the elements have different IDs (they are generated by the web framework). I can change the test manually to use
document.forms[2].elements[3]
instead of by id, which looks like this:
ellaMform:j_id77
I'm looking for a way to tell selenium to record the dom:index value for the controls so that tests will be the same between DEV and TEST.
Similar question on SO points to a plugin but is not exactly what I need: Make Selenium record IDs, not paths
IDE already has locator builders for several DOM styles (e.g., dom:index
, which matches your model, or dom:name
, which is less position-oriented). By default, they are prioritized lower than ID locators, but you can choose which locator you want to use when you record the test.
精彩评论