无法调用FirefoxDriver构造函数 [英] Unable to call FirefoxDriver constructor
本文介绍了无法调用FirefoxDriver构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
System.setProperty(webdriver.firefox.bin ,C:\ Program Files \\Mozilla Firefox\\Firefox.exe);
FirefoxProfile firefoxProfile = new FirefoxProfile();
String domain =extensions.firebug。;
firefoxProfile.setPreference(app.update.enabled,false);
firefoxProfile.addExtension(new File(D:\\\\ firebug-1.11.2-fx.xpi));
firefoxProfile.setPreference(domain +currentVersion,1.11.2);
firefoxProfile.setPreference(extensions.firebug.cookies.enableSites,true);
firefoxProfile.setPreference(extensions.firebug.allPagesActivation,on);
firefoxProfile.setPreference(domain +framePosition,bottom);
firefoxProfile.setPreference(domain +defaultPanelName,cookies);
WebDriver driver = new FirefoxDriver(firefoxProfile);
driver.get(http://www.google.com/webhp?complete=1&hl=zh-TW);
WebElement query = driver.findElement(By.name(q));
Firefox版本:20.0,萤火虫1.11.2。
我得到的错误消息是:
Exception in线程mainorg.openqa.selenium.UnsupportedCommandException:错误请求
命令持续时间或超时:437毫秒
构建信息:版本:'2.32.0',修订:'6c40c18',时间:'2013-04-09 17:23:22'
系统信息:os.name:'Windows XP',os.arch:'x86',os.version:'5.1',java.version: '1.6.0_24'
驱动程序信息:org.openqa.selenium.firefox.FirefoxDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(未知来源)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote。 ErrorHandler.createThrowable(ErrorHandler.java:187)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHand
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:
at org.openqa.selenium.remote.RemoteWebDriver。< init>(RemoteWebDriver.java:111)
at org.openqa.selenium.firefox.FirefoxDriver。< init>(FirefoxDriver。 java:190)
at org.openqa.selenium.firefox.FirefoxDriver。< init>(FirefoxDriver.java:183)
at org.openqa.selenium.firefox.FirefoxDriver。< init>( FirefoxDriver.java:179)
at org.openqa.selenium.firefox.FirefoxDriver。< init>(FirefoxDriver.java:96)
at com.vinit.tiwari.TestCookieFirefox.main(TestCookieFirefox.java :48)
解决方案
配置。
如果你有这样一行:
127.0.0.1 domain1 domain2 domain3 localhost
更改它to:
127.0.0.1 localhost domain1 domain2 domain3
I am continuously getting unsupportedCommandException when I am running the following code:
System.setProperty("webdriver.firefox.bin","C:\\Program Files\\Mozilla Firefox\\Firefox.exe");
FirefoxProfile firefoxProfile = new FirefoxProfile();
String domain = "extensions.firebug.";
firefoxProfile.setPreference("app.update.enabled", false);
firefoxProfile.addExtension(new File("D:\\\\firebug-1.11.2-fx.xpi"));
firefoxProfile.setPreference(domain + "currentVersion", "1.11.2");
firefoxProfile.setPreference("extensions.firebug.cookies.enableSites", true);
firefoxProfile.setPreference("extensions.firebug.allPagesActivation", "on");
firefoxProfile.setPreference(domain + "framePosition", "bottom");
firefoxProfile.setPreference(domain + "defaultPanelName", "cookies");
WebDriver driver = new FirefoxDriver(firefoxProfile);
driver.get("http://www.google.com/webhp?complete=1&hl=en");
WebElement query = driver.findElement(By.name("q"));
Firefox version: 20.0, firebug 1.11.2.
Error message I am getting is as under:
Exception in thread "main" org.openqa.selenium.UnsupportedCommandException: Bad request
Command duration or timeout: 437 milliseconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_24'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:190)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:183)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:179)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:96)
at com.vinit.tiwari.TestCookieFirefox.main(TestCookieFirefox.java:48)
解决方案
This may be to do with your hosts configuration.
If you have a line like this:
127.0.0.1 domain1 domain2 domain3 localhost
Change it to:
127.0.0.1 localhost domain1 domain2 domain3
这篇关于无法调用FirefoxDriver构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文