tags:

views:

96

answers:

1

Hi, I'm trying to use the DOM to locate a form element in Selenium but I can't get it to work. Even if I use the example in the Selenium documentation it still fails, for example with this html...

 <html>
  <body>
   <form id="loginForm">
    <input name="username" type="text" />
    <input name="password" type="password" />
    <input name="continue" type="submit" value="Login" />
    <input name="continue" type="button" value="Clear" />
   </form>
 </body>
 <html>

and this command in the Selenium IDE...

verifyElementPresent 

with target...

 dom=document.forms['loginForm']

I get [error] false in the log. The 'getElementById' example in the documentation does work, but none of the others.

Can someone explain what I'm doing wrong here? Thanks.

+1  A: 

Not sure why it's not working (I can replicate the problem), but perhaps there's a better way to locate your target element? I would recommend locating by ID/name, falling back to CSS or XPath.

Dave Hunt