Selenium problem locating by DOM

Posted by bartonlee on Stack Overflow See other posts from Stack Overflow or by bartonlee
Published on 2010-06-02T14:12:16Z Indexed on 2010/06/02 14:14 UTC
Read the original article Hit count: 179

Filed under:

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.

© Stack Overflow or respective owner

Related posts about selenium