firefox浏览器的第二个实例未在selenium中打开

时间:2015-09-02 15:15:55

标签: firefox selenium

我是硒的新手。而我正在尝试打开firefox浏览器的多个实例。

我没有使用任何网格。我的selenium版本是2.47.1,firefox版本是37.0.1。

此外,即使我使用quit()

,我的浏览器也不会自动关闭

以下是我的代码:

    package TestAutomation;

   import org.openqa.selenium.WebDriver;
   import org.openqa.selenium.firefox.FirefoxDriver;

   public class TestClassOpenBrowser {

public static void main(String[] args) {

    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.facebook.com");
    driver.manage().window().maximize();

    WebDriver d2 = new FirefoxDriver();
    d2.get("http://yahoo.com");
    d2.manage().window().maximize();

    driver.quit();
    d2.quit();

}

 }

2 个答案:

答案 0 :(得分:1)

请记住,版本2.42.0可能是真正支持Firefox本机事件的最后版本的Selenium(适用于Firefox 31)。 Selenium 2.43表示它支持Firefox32的原生事件,但我认为它确实无效。通常,如果您运行的是本地Firefox实例,则希望使用Firefox 31或Firefox31.0.6,即使您使用的是Selenium 2.47+。

此外,如果您在管理多个驱动程序实例时遇到问题,请查看我在此处的操作方式(请参阅ShootoutSuiteTestBase.java 课程): https://gist.github.com/djangofan/f5eda36f556fc55a5dcb

答案 1 :(得分:0)

尝试使用jar文件版本2.45.0。有效。问题出现在最新的jar文件2.47.1

相关问题