我有一个问题,因为我尝试用Eclipse开始我在Eclipse中的第一个程序。参数:selenium = 2.49.1,firefox 50.1。或防病毒卡巴斯基可以阻止任何事情?我有不正确的firefox selenium配置 - 不兼容吗?
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Login {
public static void main(String[] args) throws Exception{
// LoginTest lt = new LoginTest();
WebDriver wd = new FirefoxDriver();
wd.get("http://www.facebook.com");
wd.manage().window().maximize();
// lt.setUp();
// lt.test();
// lt.tearDown();
}
日志
Build info: version: '2.49.1', revision: '7203e46', time: '2016-01-21 17:35:35'
System info: host: 'Damian', ip: 'xxx.xxx.x.xxx', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_79'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:134)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at loginTest.Login.main(Login.java:13)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
"homepageURL":null},{"locales":["vi"],"name":"Kaspersky Protection","description":"Bảo vĂŞĚŁ baĚŁn trĂŞn Internet vơĚ?i phần mở rĂ´ĚŁng tĆ°Ě€ Kaspersky Lab","creator":null,"homepageURL":null},{"locales":["zh-Hans"],"name":"卡巴斯基保护","description":"使用卡巴斯基实验室的扩展功č?˝ĺŻąć‚¨çš„äş’č?”网的保护。","creator":null,"homepageURL":null},{"locales":["zh-Hans-CN"],"name":"卡巴斯基保护","description":"使用卡巴斯基实验室的扩展功č?˝ĺŻąć‚¨çš„äş’č?”网的保护。","creator":null,"homepageURL":null}],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"38.0a1","maxVersion":"43.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1483108475424 DeferredSave.extensions.json DEBUG Save changes
1483108475425 addons.xpi DEBUG Updating database with changes to installed add-ons
1483108475425 addons.xpi-utils DEBUG Updating add-on states
1483108475430 addons.xpi-utils DEBUG Writing add-ons list
1483108475439 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1483108475441 addons.xpi DEBUG Calling bootstrap method startup on aushelper@mozilla.org version 1.0
1483108475444 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1483108475447 addons.xpi DEBUG Calling bootstrap method startup on e10srollout@mozilla.org version 1.5
1483108475447 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1483108475450 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1483108475452 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1483108475454 addons.xpi DEBUG Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1483108475459 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1483108475459 addons.manager DEBUG Provider finished startup: XPIProvider
1483108475459 addons.manager DEBUG Starting provider: LightweightThemeManager
1483108475459 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1483108475460 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1483108475461 addons.manager DEBUG Starting provider: GMPProvider
1483108475488 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1483108475489 addons.manager DEBUG Provider finished startup: GMPProvider
1483108475489 addons.manager DEBUG Starting provider: PluginProvider
1483108475490 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1483108475490 addons.manager DEBUG Provider finished startup: PluginProvider
1483108475491 addons.manager DEBUG Completed startup sequence
1483108480573 addons.manager DEBUG Starting provider: <unnamed-provider>
1483108480574 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1483108480575 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1483108482886 DeferredSave.extensions.json DEBUG Write succeeded
1483108482886 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 17
1483108482886 DeferredSave.extensions.json DEBUG Starting timer
1483108482915 DeferredSave.extensions.json DEBUG Starting write
1483108482940 addons.repository DEBUG No addons.json found.
1483108482941 DeferredSave.addons.json DEBUG Save changes
1483108482972 DeferredSave.addons.json DEBUG Starting timer
1483108484196 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1483108484196 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1483108484197 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1483108484207 DeferredSave.addons.json DEBUG Starting write
1483108484239 DeferredSave.extensions.json DEBUG Write succeeded
1483108484933 DeferredSave.addons.json DEBUG Write succeeded
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:122)
... 7 more
也许有人知道如何帮忙?我已经花了很多时间在这个问题上,这很容易出问题吗?
答案 0 :(得分:1)
我认为您的防病毒软件阻止了您的连接。尝试将其关闭。
此外,如果您运行的是Firefox版本47+,则需要运行Selenium 3(看起来您有Selenium 2.49.1),因为Firefox在版本47及更高版本之后使用自己的geckodriver
。