51Testing软件测试论坛

标题: 虚拟机中跑Webdriver,无法点击到Continue to this website (not recommended). [打印本页]

作者: 回首见云飞    时间: 2012-4-3 15:33
标题: 虚拟机中跑Webdriver,无法点击到Continue to this website (not recommended).
本帖最后由 回首见云飞 于 2012-4-3 15:36 编辑

虚拟机:win2003
浏览器:ie8

运行时弹出如下内容,但是点击不到链接Continue to this website (not recommended).
[attach]78279[/attach]

source 如下:

<!-- Recommendation-->
<tr>
<td> </td>
<td><H2 id="recommendation"><b>We recommend that you close this webpage and do not continue to this website. </b></H2></td>
</tr>

<!-- close webpage-->
<tr>
<td > </td>
<td id="closeWebpageAlign" align="left" valign="middle">
  <h4 id="closeWebpage">
   <img src="green_shield.png" border="0" alt="Recommended icon" class="actionIcon"><a href="javascript:closePage()">Click here to close this webpage.</a>
  </h4>
</td>
</tr>


<!-- continue to site-->
<tr>
<td > </td>
<td id="continueToSiteAlign" align="left" valign="middle">
  <h4 id="continueToSite">
   <img src="red_shield.png" ID="ImgOverride" border="0" alt="Not recommended icon" class="actionIcon">

   <A href='' ID="overridelink" NAME="overridelink" >Continue to this website (not recommended).</A>
  </h4>
        </td>
</tr>


不知道这个A大写,ID大写是否有影响,之前的都是小写
下面五个方法都未成功。
id
xpath
name
linkText
partialLinkTest

求解答,谢谢。


作者: 回首见云飞    时间: 2012-4-3 16:06
我使用了如下方法解决了该问题:
driver.navigate().to("javascript:document.getElementById('overridelink').click()");       
希望对大家有用




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2