Selenium webdriver不会打开应用程序URL

时间:2016-09-21 09:43:58

标签: selenium selenium-webdriver

我使用selenium webdriver创建了一个测试框架,我在 Firefox 44.0.2 中运行相同的版本,2天后它运行正常。 但是现在它打开了firefox浏览器但是没有导航到.get方法中提到的url,下面是我的url导航代码和我得到的异常: -

WebDriver driver=new FirefoxDriver();
        driver.get("http://seleniumpractise.blogspot.in/2016/08/how-to-use-explicit-wait-in-selenium.html");

例外: -

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7056 after 45000 ms. Firefox console output:
sions\\fxdriver@googlecode.com","installDate":1474450844360,"updateDate":1474450844360,"applyBackgroundUpdates":1,"bootstrap":false,"size":3213569,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":true,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"3.0","maxVersion":"45.0"}],"targetPlatforms":[{"os":"Darwin","abi":null},{"os":"SunOS","abi":null},{"os":"FreeBSD","abi":null},{"os":"OpenBSD","abi":null},{"os":"WINNT","abi":"x86-msvc"},{"os":"Linux","abi":null}],"multiprocessCompatible":false,"signedState":0}
1474450846803   addons.xpi  DEBUG   Updating XPIState for {"id":"{972ce4c6-7e08-4474-a285-3208198ce6fd}","syncGUID":"4YrFqCoch9_A","location":"app-global","version":"44.0.2","type":"theme","internalName":"classic/1.0","updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{"32":"icon.png","48":"icon.png"},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}","installDate":1473742108164,"updateDate":1473742108164,"applyBackgroundUpdates":1,"skinnable":true,"size":24172,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"44.0.2","maxVersion":"44.0.2"}],"targetPlatforms":[]}
1474450846803   addons.xpi  DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1474450846804   DeferredSave.extensions.json    DEBUG   Save changes
1474450846805   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1474450846805   addons.xpi-utils    DEBUG   Updating add-on states
1474450846806   addons.xpi-utils    DEBUG   Writing add-ons list
1474450846819   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1474450846820   addons.manager  DEBUG   Provider finished startup: XPIProvider
1474450846820   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1474450846820   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1474450846820   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1474450846820   addons.manager  DEBUG   Starting provider: GMPProvider
1474450846832   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1474450846833   addons.manager  DEBUG   Provider finished startup: GMPProvider
1474450846833   addons.manager  DEBUG   Starting provider: PluginProvider
1474450846833   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1474450846833   addons.manager  DEBUG   Provider finished startup: PluginProvider
1474450846833   addons.manager  DEBUG   Completed startup sequence
1474450847985   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1474450847985   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1474450847986   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1474450848873   DeferredSave.extensions.json    DEBUG   Starting write
1474450849387   addons.repository   DEBUG   No addons.json found.
1474450849387   DeferredSave.addons.json    DEBUG   Save changes
1474450849393   DeferredSave.addons.json    DEBUG   Starting timer
1474450849415   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1474450849415   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1474450849416   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1474450849420   DeferredSave.extensions.json    DEBUG   Write succeeded
1474450849420   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1474450849457   DeferredSave.addons.json    DEBUG   Starting write
1474450849470   DeferredSave.addons.json    DEBUG   Write succeeded

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:122)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
    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 dd_core.page.init(page.java:68)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:296)
    at org.testng.SuiteRunner.run(SuiteRunner.java:259)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
    at org.testng.TestNG.run(TestNG.java:1018)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

我添加了selenium-java-2.48.2.jar。请建议!!

2 个答案:

答案 0 :(得分:0)

使用FF 46.0正常运行,请尝试更新ff版本。

答案 1 :(得分:0)

大部分时间都是因为浏览器版本只是升级您的版本并再次运行您的代码