FirefoxDriver总是从“firstrun”开始页面,打破所有的测试脚本 [英] FirefoxDriver always starting on "firstrun" page, breaking all test scripts

查看:144
本文介绍了FirefoxDriver总是从“firstrun”开始页面,打破所有的测试脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从昨晚开始,FirefoxDriver一直在这个页面打开: https://www.mozilla.org/en-US/firefox/42.0/firstrun/learnmore/ 。我曾尝试更改默认配置文件设置,并没有任何成功。

以下问题, http://stackoverflow.com/questions/ 33937067 / firefox-webdriver-opens-first-run-page-all-the-time 是类似的,但是我没有看到在哪里实现了四行代码,而且我个人试图抛出它到我的脚本已被证明是徒劳的。



这个问题昨晚开始绝对是蓝色的。

实例化WebDriver实例会导致NoSuchMethodError:

  FirefoxProfile profile = new FirefoxProfile(); 
profile.setPreference(browser.startup.homepage,about:blank);
profile.setPreference(startup.homepage_welcome_url,about:blank);
profile.setPreference(startup.homepage_welcome_url.additional,about:blank);
driver = new FirefoxDriver(profile);
driver.manage()。timeouts()。implicitlyWait(30,TimeUnit.SECONDS);

但是在<$ $中删除 profile c $ c> FirefoxDriver 将它返回到上面提到的firstrun页面。 管理员使用Firefox.exe - p

您将拥有多个配置文件。请选择默认配置文件,并使其始终默认。



不应该打开该页面。我测试过,它工作正常。



你可以试试这个代码。我很确定它会工作。

  ProfilesIni配置文件=新ProfilesIni(); 
FirefoxProfile ffprofile = profile.getProfile(default);
WebDriver driver = new FirefoxDriver(ffprofile);
driver.manage()。timeouts()。implicitlyWait(30,TimeUnit.SECONDS);


Starting just last night, the FirefoxDriver has been always opening on this page: https://www.mozilla.org/en-US/firefox/42.0/firstrun/learnmore/. I have tried changing the default profile settings and have not had any success.

The following question, http://stackoverflow.com/questions/33937067/firefox-webdriver-opens-first-run-page-all-the-time, is similar, but I do not see where to implement the four lines of code, and my personal attempts of throwing it into my scripts have proved futile.

This problem started absolutely out of the blue last night. I have presentations to do today and I can't get any of my scripts to work.

Instantiating my WebDriver instance like so will cause a NoSuchMethodError:

                FirefoxProfile profile = new FirefoxProfile();
                profile.setPreference("browser.startup.homepage", "about:blank");
                profile.setPreference("startup.homepage_welcome_url", "about:blank");
                profile.setPreference("startup.homepage_welcome_url.additional", "about:blank");
                driver = new FirefoxDriver(profile);
                driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

But getting rid of profile in FirefoxDriver brings it back to the firstrun page mentioned above.

解决方案

Go to profile manager using "Firefox.exe - p"

You will have more than one profile. Please select default profile and make it default all time.

It should not open that page. i tested and it works fine.

You can try this code. I am pretty sure it will work.

    ProfilesIni profile = new ProfilesIni();
    FirefoxProfile ffprofile = profile.getProfile("default");
    WebDriver driver = new FirefoxDriver(ffprofile);
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

这篇关于FirefoxDriver总是从“firstrun”开始页面,打破所有的测试脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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