私は、セレンのJavaコードを使用してFirefoxブラウザを開こうとしています。はセレンのwebdriverで新しいセッションを開始できませんでした
System.setProperty("webdriver.gecko.driver", " System.setProperty("webdriver.gecko.driver", "C:/Program Files/Mozilla Firefox/geckodriver-v0.8.0-win32/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
System.setProperty("webdriver.firefox.port","4444");
Seleniumサーバーが起動しています。私は、コマンドプロンプトを使用してセレンのサーバーポートを変更しようとし、ポートにコードを設定しましたが、どちらも動作しません。
> Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: 'unknown', revision: '2aa21c1', time: '2016-08-02 14:59:43 -0700'
System info: host: 'W0045395', ip: '10.17.208.124', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:670)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:232)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:220)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:215)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:124)
at newpackage.Gmail_Login.main(Gmail_Login.java:18)
Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:6544 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
Build info: version: 'unknown', revision: '2aa21c1', time: '2016-08-02 14:59:43 -0700'
System info: host: 'W0045395', ip: '10.17.208.124', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:649)
... 8 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:6544 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:142)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:88)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
... 9 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
... 22 more
エラーメッセージ "Connect to localhost:6544"では、毎回別のローカルホストに接続しようとしました。誰が問題がどこにあるか見ることができますか?私が使用している
バージョンは、次のとおり
- のFirefox 48.0
- セレン3.0.0ベータ2
- Windows 7の32ビット
- geckodriver-v0.8.0-Win32の
また、私のgeckodriver実行ファイルが実行されていないと、VCRUNTIME140.dillが見つからないと問題を解決するために再インストールする必要があります。しかし、私はそれを再インストールした後、同じことが起こった。 @ Saurabhの提案のための
アップデート
おかげで、私は2.53.1に私のセレンを格下げ。ブラウザが開かれていますが、何も表示されません。
System.setProperty("webdriver.gecko.driver", "C:/Program Files/Mozilla Firefox/geckodriver-v0.8.0-win32/geckodriver.exe");
//Now you can Initialize marionette driver to launch firefox
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(capabilities);
編集:残念ながら上記の動作しない場合は、私は希望 - :そして、私は別のエラーあなたは、以下のようにもFirefoxDriver
にtrue
にmarionette
機能でDesiredCapabilities
を渡す必要が
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
ateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":"chrome://web2pdfextension/skin/C_AdobeLogo_48x48.png","icon64URL":"chrome://web2pdfextension/skin/C_AdobeLogo_64x64.png","defaultLocale":{"name":"Adobe Acrobat DC - Create PDF","description":"Converts a web page to PDF","creator":"Adobe Systems Incorporated","homepageURL":"http://www.adobe.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Browser\\WCFirefoxExtn","installDate":1463491629403,"updateDate":1463491629403,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":345393,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"4.0","maxVersion":"46.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1471356838157 DeferredSave.extensions.json DEBUG Save changes
1471356838157 addons.xpi DEBUG Updating database with changes to installed add-ons
1471356838157 addons.xpi-utils DEBUG Updating add-on states
1471356838158 addons.xpi-utils DEBUG Writing add-ons list
1471356838161 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1471356838162 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.0
1471356838162 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1471356838162 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.0.4
1471356838163 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1471356838164 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.4.3
1471356838181 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1471356838181 addons.manager DEBUG Provider finished startup: XPIProvider
1471356838181 addons.manager DEBUG Starting provider: LightweightThemeManager
1471356838181 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1471356838181 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1471356838182 addons.manager DEBUG Starting provider: GMPProvider
1471356838187 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1471356838187 addons.manager DEBUG Provider finished startup: GMPProvider
1471356838187 addons.manager DEBUG Starting provider: PluginProvider
1471356838187 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1471356838187 addons.manager DEBUG Provider finished startup: PluginProvider
1471356838188 addons.manager DEBUG Completed startup sequence
1471356839788 addons.manager DEBUG Starting provider: <unnamed-provider>
1471356839788 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1471356839788 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1471356840362 DeferredSave.extensions.json DEBUG Write succeeded
1471356840362 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 17
1471356840362 DeferredSave.extensions.json DEBUG Starting timer
1471356840374 addons.repository DEBUG No addons.json found.
1471356840374 DeferredSave.addons.json DEBUG Save changes
1471356840377 DeferredSave.addons.json DEBUG Starting timer
1471356840413 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1471356840413 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1471356840413 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1471356840421 DeferredSave.extensions.json DEBUG Starting write
1471356840440 DeferredSave.addons.json DEBUG Starting write
1471356840460 DeferredSave.extensions.json DEBUG Write succeeded
1471356840495 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:129)
at newpackage.Gmail_Login.main(Gmail_Login.java:25)
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on port 7055; process output follows:
ateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":"chrome://web2pdfextension/skin/C_AdobeLogo_48x48.png","icon64URL":"chrome://web2pdfextension/skin/C_AdobeLogo_64x64.png","defaultLocale":{"name":"Adobe Acrobat DC - Create PDF","description":"Converts a web page to PDF","creator":"Adobe Systems Incorporated","homepageURL":"http://www.adobe.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Browser\\WCFirefoxExtn","installDate":1463491629403,"updateDate":1463491629403,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":345393,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"4.0","maxVersion":"46.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1471356838157 DeferredSave.extensions.json DEBUG Save changes
1471356838157 addons.xpi DEBUG Updating database with changes to installed add-ons
1471356838157 addons.xpi-utils DEBUG Updating add-on states
1471356838158 addons.xpi-utils DEBUG Writing add-ons list
1471356838161 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1471356838162 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.0
1471356838162 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1471356838162 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.0.4
1471356838163 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1471356838164 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.4.3
1471356838181 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1471356838181 addons.manager DEBUG Provider finished startup: XPIProvider
1471356838181 addons.manager DEBUG Starting provider: LightweightThemeManager
1471356838181 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1471356838181 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1471356838182 addons.manager DEBUG Starting provider: GMPProvider
1471356838187 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1471356838187 addons.manager DEBUG Provider finished startup: GMPProvider
1471356838187 addons.manager DEBUG Starting provider: PluginProvider
1471356838187 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1471356838187 addons.manager DEBUG Provider finished startup: PluginProvider
1471356838188 addons.manager DEBUG Completed startup sequence
1471356839788 addons.manager DEBUG Starting provider: <unnamed-provider>
1471356839788 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1471356839788 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1471356840362 DeferredSave.extensions.json DEBUG Write succeeded
1471356840362 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 17
1471356840362 DeferredSave.extensions.json DEBUG Starting timer
1471356840374 addons.repository DEBUG No addons.json found.
1471356840374 DeferredSave.addons.json DEBUG Save changes
1471356840377 DeferredSave.addons.json DEBUG Starting timer
1471356840413 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1471356840413 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1471356840413 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1471356840421 DeferredSave.extensions.json DEBUG Starting write
1471356840440 DeferredSave.addons.json DEBUG Starting write
1471356840460 DeferredSave.extensions.json DEBUG Write succeeded
1471356840495 DeferredSave.addons.json DEBUG Write succeeded
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:09'
System info: host: 'W0045395', ip: '10.17.208.124', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
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:129)
at newpackage.Gmail_Login.main(Gmail_Login.java:25)
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:
ateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":"chrome://web2pdfextension/skin/C_AdobeLogo_48x48.png","icon64URL":"chrome://web2pdfextension/skin/C_AdobeLogo_64x64.png","defaultLocale":{"name":"Adobe Acrobat DC - Create PDF","description":"Converts a web page to PDF","creator":"Adobe Systems Incorporated","homepageURL":"http://www.adobe.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Browser\\WCFirefoxExtn","installDate":1463491629403,"updateDate":1463491629403,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":345393,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"4.0","maxVersion":"46.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1471356838157 DeferredSave.extensions.json DEBUG Save changes
1471356838157 addons.xpi DEBUG Updating database with changes to installed add-ons
1471356838157 addons.xpi-utils DEBUG Updating add-on states
1471356838158 addons.xpi-utils DEBUG Writing add-ons list
1471356838161 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1471356838162 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.0
1471356838162 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1471356838162 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.0.4
1471356838163 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1471356838164 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.4.3
1471356838181 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1471356838181 addons.manager DEBUG Provider finished startup: XPIProvider
1471356838181 addons.manager DEBUG Starting provider: LightweightThemeManager
1471356838181 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1471356838181 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1471356838182 addons.manager DEBUG Starting provider: GMPProvider
1471356838187 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1471356838187 addons.manager DEBUG Provider finished startup: GMPProvider
1471356838187 addons.manager DEBUG Starting provider: PluginProvider
1471356838187 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1471356838187 addons.manager DEBUG Provider finished startup: PluginProvider
1471356838188 addons.manager DEBUG Completed startup sequence
1471356839788 addons.manager DEBUG Starting provider: <unnamed-provider>
1471356839788 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1471356839788 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1471356840362 DeferredSave.extensions.json DEBUG Write succeeded
1471356840362 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 17
1471356840362 DeferredSave.extensions.json DEBUG Starting timer
1471356840374 addons.repository DEBUG No addons.json found.
1471356840374 DeferredSave.addons.json DEBUG Save changes
1471356840377 DeferredSave.addons.json DEBUG Starting timer
1471356840413 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1471356840413 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1471356840413 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1471356840421 DeferredSave.extensions.json DEBUG Starting write
1471356840440 DeferredSave.addons.json DEBUG Starting write
1471356840460 DeferredSave.extensions.json DEBUG Write succeeded
1471356840495 DeferredSave.addons.json DEBUG Write succeeded
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
... 6 more
あなたのマシンにはFirefoxがインストールされていますか? – ChanChow
なぜgeckoドライバを使いたいですか? firefoxを起動するには、org.openqa.selenium.firefox.FirefoxDriverをインポートする必要があります。 – ChanChow
@AllIsWellはい、私はfirefoxをインストールしました。私はこのエラーだったと思う "例外のメイン" org.openqa.selenium.WebDriverException:ドライバの実行可能ファイルへのパスは、webdriver.gecko.driverシステムプロパティで設定する必要があります;詳細については、https:// githubを参照してください。 .com/jgraham/wires。最新のバージョンは....からダウンロードできます。 "だから代わりにゲッコを使用しました –