我正在尝试仅通过硒使Internet Explorer自动化一些功能(仅IMP:仅IE。其他浏览器均未提供)。是IE 11。
这是登录页面的HTML代码
"$w"
以下是我通过Selenium脚本执行的步骤
-问题在下面-
这是硒代码</ p>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login page </title>
</head>
<body>
<form name="Login" method="POST" action="/Project/LoginServlet" onsubmit="return validate_form ( );">
<P ALIGN='center' >
<br /><br/>
<img src="/Project/images/image1.JPG" width=1300px height=100px />
</P>
<p ALIGN='center'>
<table border="1">
<tr><td colspan="2" align="Left">* Enter Username and Password</tr>
<tr>
<th><b>Username : </b><font size="3" color="red" >*</font></th>
<th> <input type="text" name="username" size="50" ></th>
</tr>
<tr>
<th><b>Password : </b><font size="3" color="red">*</font></th>
<th> <input type="password" name="pwd" size="50" ></th>
</tr>
</table>
<br><table>
<TR> <input type="submit" value="Login" name="B1"></TR>
</TABLE>
<br><br>
<br>
</P>
</form>
</body>
</html>
我尝试提供错误的用户名和密码组合,并且可以正常工作,因为我在页面上内联显示了一个错误。 URL也会更改,带有处理登录名的servlet名称。由于某些原因,我无法超越“登录”页面。
此外,我尝试直接运行批处理文件,它运行正常。由于某种原因,当詹金斯(Jenkins)调用它时,它会执行所有操作,但会在“登录”页面上停止!!
我也尝试过增加等待时间,因为Selenium在Jenkins身上工作缓慢。结果还是一样。
所有硒代码都在用@TEST标记注释的JAVA方法中编写,以使其由TestNG执行。 Jenkins通过调用批处理文件来调用TestNG和其他类/库。