无法在Firefox中启动URL
我无法在Firefox中启动URL。 浏览器已成功启动,但打开的URL为:“”。 一段时间后,这个浏览器会自动关闭 这可能是配置文件设置的问题,但不确定如何解决此问题 使用的代码:无法在Firefox中启动URL,firefox,selenium,selenium-webdriver,Firefox,Selenium,Selenium Webdriver,我无法在Firefox中启动URL。 浏览器已成功启动,但打开的URL为:“”。 一段时间后,这个浏览器会自动关闭 这可能是配置文件设置的问题,但不确定如何解决此问题 使用的代码: import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Launchingbrowsers { public static void main(String[]
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Launchingbrowsers {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get("https://www.facebook.com/?_rdr=p");
}
}
请帮助解决此问题的步骤这可能有助于消除Firefox的“首次运行”页面:
前两个答案(可能更倾向于)都建议使用看似合理的
FirefoxProfile
配置来消除问题。我假设您的测试超时,因为Firefox无法加载配置文件,所以它可以启动浏览器,但无法导航到您的web。
您必须降级Firefox,或升级Selenium,或同时降级Firefox和Selenium。有两种可能的解决方案
希望这能有所帮助:)我认为这是因为最新的Mozilla firefox更新版本出现了新问题 这也发生在我身上 要解决这个问题,您需要将preference设置为
xpinstall.signatures.required“,false
到firefox配置文件,然后将其传递给驱动程序对象
firefoxProfile.setPreference("xpinstall.signatures.required", false);
下面的代码对我来说很好
static WebDriver driver=null;
public static void main(String[] args) {
final FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("xpinstall.signatures.required", false);
driver = new FirefoxDriver(firefoxProfile);
driver.get("https://www.google.de/");
希望它能帮助您:)您想实现什么?不管Firefox有什么问题,只要驱动程序认为它加载了Facebook页面,它就会退出。为什么不在页面加载后添加延迟,或者执行一些操作和断言呢?添加wait命令将不会有帮助,因为我尝试获取的URL没有得到响应没有使用driver.quit()或driver.close()我的观点是什么浏览器关闭。我正在使用selenium和firefox的最新版本。正如我在回答中提到的,您可能需要降级firefox。能否卸载当前的firefox,从此URL下载v.41.,安装并尝试再次运行测试?我尝试过,但仍然面临问题。我尝试通过驱动程序打开facebook。get()方法。但不知道为什么,Firefox启动了,但有两个不相关的选项卡。生成的错误是:原因:org.openqa.selenium.WebDriverException:目标URL www.facebook.com格式不正确。构建信息:版本:'2.52.0',版本:'4c2593c',时间:'2016-02-11 19:03:33'系统信息:主机:'suman',ip:'192.168.1.4',os.name:'Windows 8.1',os.arch:'amd64',os.version:'6.3',java.version:'1.8.0_45'驱动程序信息:Driver.version:unknown at.FirefoxDriver.prototype.get(file:///C:/Users/SumanV/AppData/Local/Temp/anonymous7235374065244074506webdriver-简介/扩展/fxdriver@googlecode.com/components/driver component.js:10589)(1/2)(2/2)位于.DelayedCommand.prototype.executeInternal\uh(file:///C:/Users/SumanV/AppData/Local/Temp/anonymous7235374065244074506webdriver-简介/扩展/fxdriver@googlecode.com/components/command processor.js:12614)位于.DelayedCommand.prototype.executeInternal_(file:///C:/Users/SumanV/AppData/Local/Temp/anonymous7235374065244074506webdriver-简介/扩展/fxdriver@googlecode.com/components/command processor.js:12619)位于.DelayedCommand.prototype.execute/