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

查看:30
本文介绍了无法使用带有 Java 的 Selenium2 (Webdriver) 启动 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. 打开浏览器
  2. 转到工具 -> Internet 选项 -> 安全
  3. 将所有区域(互联网、本地 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.

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

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