Hi guys,
When I used Watir to test, I got something strange.
Error occurs when I try to login on the system, when I visit the
homepage manually and input the username and password, it seems good.
But when I used watir, after I entered the username/password and click
the login button, it wait for about 20 second and then close the current
iexplore window.
The script I used to test the application:
require 'Watir'
include Watir
$IE0 = IE.new
$IE0.goto("http://10.170.0.165:7001/")
$IE0.wait
$IE0.form( :name, "form").text_field( :name, "username").set("admin")
$IE0.form( :name, "form").text_field( :name, "password").set("passwd")
$IE0.form( :name, "form").button( :name, "btlogin").click
$IE0.wait
sleep(20)
$IE1 = IE.attach( :title, "alert")
$IE1.frame( :name, "leftFrame").link( :name, "nodeIcon5").click
The homepage is very simple so I paste it here:
<body class="login_body" onload="javascript: form.username.focus();">
<table class="common_table">
<form name="form" method="post" action="com.myapp.user.UserManage"
target="indexwin">
<input type="hidden" name="act" value="login">
<tr>
<td class="login_td_bg">
<table class="login_table" cellpadding="0">
<tr>
<td><img src="images/login_top.jpg"></td>
</tr>
<tr>
<td class="login_user_td">
<table class="login_table">
<tr>
<td>UserName</td>
<td> <input type="text" class="login_input" tabIndex="1"
name="username" onkeydown="javascript: return JumpToPassword();"></td>
</tr>
<tr>
<td>Password</td>
<td> <input type="password" tabIndex="2" name="password"
class="login_input" onkeydown="javascript: return SubmitForm();"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="login_button_td">
<input type="button" id="btlogin" name="btlogin" tabIndex="3"
value="Login" class="button" onclick="javascript: formsubmit(); return
false;">
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</body>
when user click "Login" button , function "formsubmit()" is called, the
content of function "formsubit" is listed below:
function formsubmit(){
//Check the user name
if(form.username.value==""){
alert("Please enter username! ");
return false;
}
//Check the password
if(form.password.value==""){
alert("Please enter password! ");
return false;
}
disabledbutton();
if(window.name != "indexwin"){
window.open("about:blank","indexwin","resizable=1,left=0,top=0,height="
+(screen.height-50)+", width="+(screen.width-10));
}
form.submit();
if(window.name != "indexwin"){
closeWin();
}
}
Any help is appreciated, thanx.
dennis
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general