硒2.53.0与firefox 46

时间:2017-03-31 08:07:14

标签: firefox selenium-webdriver

我是selenium的新手,我正在使用selenium 2.53.0和firefox 46并执行非常简单的代码 import org.openqa.selenium.firefox.FirefoxDriver;

public class test {

public static void main(String[] args) {
    FirefoxDriver driver=new FirefoxDriver();
    driver.get("http://google.com");

}

}

当我执行此代码时,我的firefox浏览器会打开,但它不会打开“google.com”

    org.openqa.selenium.firefox.NotConnectedException: Unable to connect to 
       host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
       fee SiteAdvisor Enterprise","description":null,"creator":"McAfee 




  Inc.","homepageURL":"http://www.siteadvisor.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\McAfee\\SiteAdvisor Enterprise\\saeffplg.xpi","installDate":1455580102000,"updateDate":1455580102000,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":349132,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"15.0","maxVersion":"47.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1490946675982   DeferredSave.extensions.json    DEBUG   Save changes
1490946675982   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1490946675983   addons.xpi-utils    DEBUG   Updating add-on states
1490946675988   addons.xpi-utils    DEBUG   Writing add-ons list
1490946676009   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1490946676010   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.0
1490946676010   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1490946676012   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.2
1490946676013   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\loop@mozilla.org.xpi
1490946676015   addons.xpi  DEBUG   Calling bootstrap method startup on loop@mozilla.org version 1.3.2
1490946676032   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\websensehelper@mozilla.org.xpi
1490946676033   addons.xpi  DEBUG   Calling bootstrap method startup on websensehelper@mozilla.org version 1.0
1490946676036   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1490946676038   addons.manager  DEBUG   Provider finished startup: XPIProvider
1490946676038   addons.manager  DEBUG   Starting provider: 
     LightweightThemeManager
1490946676038   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1490946676038   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1490946676039   addons.manager  DEBUG   Starting provider: GMPProvider
1490946676045   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1490946676046   addons.manager  DEBUG   Provider finished startup: GMPProvider
1490946676046   addons.manager  DEBUG   Starting provider: PluginProvider
1490946676046   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1490946676046   addons.manager  DEBUG   Provider finished startup: PluginProvider
1490946676046   addons.manager  DEBUG   Completed startup sequence
1490946677662   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1490946677662   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1490946677663   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1490946677955   DeferredSave.extensions.json    DEBUG   Write succeeded
1490946677955   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1490946677955   DeferredSave.extensions.json    DEBUG   Starting timer
1490946678047   DeferredSave.extensions.json    DEBUG   Starting write
1490946678069   addons.repository   DEBUG   No addons.json found.
1490946678070   DeferredSave.addons.json    DEBUG   Save changes
1490946678075   DeferredSave.addons.json    DEBUG   Starting timer
1490946678174   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1490946678174   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1490946678174   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1490946678177   DeferredSave.addons.json    DEBUG   Starting write
1490946678192   DeferredSave.extensions.json    DEBUG   Write succeeded
1490946678224   DeferredSave.addons.json    DEBUG   Write succeeded

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
    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 test.main(test.java:7)
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows: 
fee SiteAdvisor Enterprise","description":null,"creator":"McAfee Inc.","homepageURL":"http://www.siteadvisor.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\McAfee\\SiteAdvisor Enterprise\\saeffplg.xpi","installDate":1455580102000,"updateDate":1455580102000,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":349132,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"15.0","maxVersion":"47.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1490946675982   DeferredSave.extensions.json    DEBUG   Save changes
1490946675982   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1490946675983   addons.xpi-utils    DEBUG   Updating add-on states
1490946675988   addons.xpi-utils    DEBUG   Writing add-ons list
1490946676009   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1490946676010   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.0
1490946676010   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1490946676012   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.2
1490946676013   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\loop@mozilla.org.xpi
1490946676015   addons.xpi  DEBUG   Calling bootstrap method startup on loop@mozilla.org version 1.3.2
1490946676032   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\websensehelper@mozilla.org.xpi
1490946676033   addons.xpi  DEBUG   Calling bootstrap method startup on websensehelper@mozilla.org version 1.0
1490946676036   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1490946676038   addons.manager  DEBUG   Provider finished startup: XPIProvider
1490946676038   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1490946676038   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1490946676038   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1490946676039   addons.manager  DEBUG   Starting provider: GMPProvider
1490946676045   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1490946676046   addons.manager  DEBUG   Provider finished startup: GMPProvider
1490946676046   addons.manager  DEBUG   Starting provider: PluginProvider
1490946676046   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1490946676046   addons.manager  DEBUG   Provider finished startup: PluginProvider
1490946676046   addons.manager  DEBUG   Completed startup sequence
1490946677662   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1490946677662   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1490946677663   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1490946677955   DeferredSave.extensions.json    DEBUG   Write succeeded
1490946677955   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1490946677955   DeferredSave.extensions.json    DEBUG   Starting timer
1490946678047   DeferredSave.extensions.json    DEBUG   Starting write
1490946678069   addons.repository   DEBUG   No addons.json found.
1490946678070   DeferredSave.addons.json    DEBUG   Save changes
1490946678075   DeferredSave.addons.json    DEBUG   Starting timer
1490946678174   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1490946678174   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1490946678174   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1490946678177   DeferredSave.addons.json    DEBUG   Starting write
1490946678192   DeferredSave.extensions.json    DEBUG   Write succeeded
1490946678224   DeferredSave.addons.json    DEBUG   Write succeeded

Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
System info: host: 'EQ-EQ5000787', ip: '10.237.211.31', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:124)
    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 test.main(test.java:7)
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:
fee SiteAdvisor Enterprise","description":null,"creator":"McAfee Inc.","homepageURL":"http://www.siteadvisor.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\McAfee\\SiteAdvisor Enterprise\\saeffplg.xpi","installDate":1455580102000,"updateDate":1455580102000,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":349132,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"15.0","maxVersion":"47.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1490946675982   DeferredSave.extensions.json    DEBUG   Save changes
1490946675982   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1490946675983   addons.xpi-utils    DEBUG   Updating add-on states
1490946675988   addons.xpi-utils    DEBUG   Writing add-ons list
1490946676009   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1490946676010   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.0
1490946676010   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1490946676012   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.2
1490946676013   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\loop@mozilla.org.xpi
1490946676015   addons.xpi  DEBUG   Calling bootstrap method startup on loop@mozilla.org version 1.3.2
1490946676032   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\websensehelper@mozilla.org.xpi
1490946676033   addons.xpi  DEBUG   Calling bootstrap method startup on websensehelper@mozilla.org version 1.0
1490946676036   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1490946676038   addons.manager  DEBUG   Provider finished startup: XPIProvider
1490946676038   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1490946676038   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1490946676038   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1490946676039   addons.manager  DEBUG   Starting provider: GMPProvider
1490946676045   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1490946676046   addons.manager  DEBUG   Provider finished startup: GMPProvider
1490946676046   addons.manager  DEBUG   Starting provider: PluginProvider
1490946676046   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1490946676046   addons.manager  DEBUG   Provider finished startup: PluginProvider
1490946676046   addons.manager  DEBUG   Completed startup sequence
1490946677662   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1490946677662   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1490946677663   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1490946677955   DeferredSave.extensions.json    DEBUG   Write succeeded
1490946677955   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1490946677955   DeferredSave.extensions.json    DEBUG   Starting timer
1490946678047   DeferredSave.extensions.json    DEBUG   Starting write
1490946678069   addons.repository   DEBUG   No addons.json found.
1490946678070   DeferredSave.addons.json    DEBUG   Save changes
1490946678075   DeferredSave.addons.json    DEBUG   Starting timer
1490946678174   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1490946678174   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1490946678174   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1490946678177   DeferredSave.addons.json    DEBUG   Starting write
1490946678192   DeferredSave.extensions.json    DEBUG   Write succeeded
1490946678224   DeferredSave.addons.json    DEBUG   Write succeeded

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
    ... 7 more

我能做些什么让我的Firefox再次运行。?

非常感谢

1 个答案:

答案 0 :(得分:0)

从您获得的异常中,我可以理解关闭Macfee防火墙并使用这段代码来调用firefox驱动程序。如果有任何问题,请告诉我。

   File pathToBinary = new File("C:\\Mozilla Firefox\\firefox.exe");
   FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary);
   FirefoxProfile firefoxProfile = new FirefoxProfile();       
   driver = new FirefoxDriver(ffBinary,firefoxProfile);