无法使用Selenium2(Webdriver)与Java一起启动IE浏览器 [英] Not able to launch IE browser using Selenium2 (Webdriver) with Java

查看:162
本文介绍了无法使用Selenium2(Webdriver)与Java一起启动IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法启动IE浏览器来运行用Java编写的selenium自动化测试。我正在使用Windows 7和IE 9.以下是我的代码:

I'm not able to launch IE browser to run my selenium automated tests written in Java. I'm using Windows 7 and IE 9. Below is my code:

请找到附件。

public class GoogleNews {
    private WebDriver driver;
    private String baseUrl;
    private StringBuffer verificationErrors = new StringBuffer();
    ArrayList al = new ArrayList();
    @Before
    public void setUp() throws Exception {
        //driver = new FirefoxDriver();
        driver =new InternetExplorerDriver();
        baseUrl = "https://news.google.co.in/";

    }

    @Test
    public void testApple() throws Exception {
        driver.get(baseUrl);
    }
}


推荐答案

它需要在所有区域中设置相同的安全级别。为此,请按照以下步骤操作:

It needs to set same Security level in all zones. To do that follow the steps below:


  1. 打开IE

  2. 转到工具 - > Internet选项 - >安全性

  3. 将所有区域(Int​​ernet,本地Intranet,受信任的站点,受限制的站点)设置为相同的保护模式,启用或禁用无关紧要。

最后,右键单击位于右上角的齿轮并启用状态栏,将缩放级别设置为100%。
默认缩放级别现在显示在右下角。

Finally, set Zoom level to 100% by right clicking on the gear located at the top right corner and enabling the status-bar. Default zoom level is now displayed at the lower right.

这篇关于无法使用Selenium2(Webdriver)与Java一起启动IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆