All,

Forgive me if I am asking an obvious question, I have been using Watir for
a short time, but have been enjoying it.  Now I personally have a problem.
I need to automate the login for further testing, but I cannot figure out
how to access the 'Log In' button which has been defined in the Cascading
Style Sheets.  Any help would be appreciated.

Dave


-=-=- getHTML -=-=-

irb(main):072:0> ie.frame("main").frame("frmLogin").getHTML
=> "\r\n<BODY language=javascript class=normal oncontextmenu=\"return false\" 
bottomMargin=0 leftMargin=0 background=../../graphics/side_1.gif topMargin=0 o
nload=isError(); rightMargin=0><FORM onkeypress=checkKey(); id=frmLogin name=f
rmLogin action=verifyLogin.asp method=post target=_self>\r\n<TABLE cellSpacing
=0 cellPadding=0 width=\"100%\" border=0>\r\n<TBODY>\r\n<TR>\r\n<TD class=text
o style=\"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; PADDING-
TOP: 5px\">user: </TD>\r\n<TD style=\"PADDING-RIGHT: 2px; PADDING-LEFT: 2px; P
ADDING-BOTTOM: 2px; PADDING-TOP: 2px\"><INPUT class=texto id=user size=12 name
=user width=\"100%\"> </TD></TR>\r\n<TR>\r\n<TD class=texto style=\"PADDING-RI
GHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px\">password:
</TD>\r\n<TD style=\"PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2p
x; PADDING-TOP: 2px\"><INPUT class=texto id=pass type=password size=12 value=\
"\" name=pass width=\"100%\"> </TD></TR>\r\n<TR>\r\n<TD align=middle colSpan=2
>\r\n<TABLE height=20 cellSpacing=0 cellPadding=0 border=0>\r\n<TBODY>\r\n<TR>
\r\n<TD class=loginOnOut onmouseover=\"javascript:this.className='loginOnOver'
\" style=\"WIDTH: 60px; HEIGHT: 22px\" onclick=javascript:verifyUser(); onmous
eout=\"javascript:this.className='loginOnOut'\">&nbsp;&nbsp;&nbsp; </TD></TR><
/TBODY></TABLE></TD></TR></TBODY></TABLE></FORM></BODY>"


-=-=- Formated third row of the login table -=-=-

<tr>
  <td colspan="2" align="center">
    <table border="0" cellpadding="0" cellspacing="0" height="20">
      <tr>
        <td class="loginOnOut" onclick="javascript:verifyUser();" 
        onmouseover="javascript:this.className='loginOnOver'" 
        onmouseout="javascript:this.className='loginOnOut'" 
        style="height:22px; width:60px;">&nbsp;&nbsp;&nbsp;
        </td>
      </tr>
    </table>
  </td>
</tr>


-=-=- CSS -=-=-

td.loginOnOver{
        background-image: url(../graphics/logindown.jpg);
        height: 22px;
        width: 60px;
        cursor: hand;
}

td.loginOnOut{
        background-image: url(../graphics/loginup.jpg);
        height: 22px;
        width: 60px;
}


-=-=- Test code to login (minus clicking the 'Log In' button) -=-=-

require 'test/unit'
#variables
testSite = "http://192.168.5.5/login/";
#open the IE browser
ie = IE.new

ie.goto(testSite)

puts "Entering user ID"
ie.frame("main").frame("frmLogin").text_field(:name,"user").set("testeracct")
puts "Entering user password"
ie.frame("main").frame("frmLogin").text_field(:name,"pass").set("123456")
puts "Clicking Log In button"

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to