简体   繁体   中英

Exception in thread “main” org.openqa.selenium.WebDriverException: java.io.IOException: Unable to parse URL: http://localhost:?????/session

How do I deal with below exception. I am using selenium v3.141.59 and geckodriver v0.26 and firefox v65.0. I am getting the same exception for chrome as well.

Exception in thread "main" org.openqa.selenium.WebDriverException: java.io.IOException: Unable to parse URL: http://localhost:?????/session
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'HP', ip: '172.29.11.119', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
    at SeleniumDrivers.main(SeleniumDrivers.java:10)
Caused by: java.io.IOException: Unable to parse URL: http://localhost:?????/session
    at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:64)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)

It looks like your port is: ?????

You should point to your application port (if you are on a custom port (not 80 or 443))

Check you application port:

Windows:

CMD -> netstat -a

Check the listening ports.

Linux:

Terminal -> netstat -tlnp

Check the listening ports.

Default web traffic runs on port 80 (Unencrypted) 443 (encrypted). You can troubleshoot the selenium by trying to visit https://duckduckgo.com instead of your localhost.

Check the documentation according to the language you are writing and check if the basics are in order. https://www.selenium.dev/documentation/en/

This error message...

Exception in thread "main" org.openqa.selenium.WebDriverException: java.io.IOException: Unable to parse URL: http://localhost:?????/session
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'HP', ip: '172.29.11.119', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
    .
    .
Caused by: java.io.IOException: Unable to parse URL: http://localhost:?????/session

...implies that the GeckoDriver was unable to initiate/spawn a new Browsing Context ie Firefox Browser session.

As per the discussion in Unable to parse URL: http://localhost:????/session this error is observed due to incompatible comptuer language settings.


Solution

This issue can be addressed by setting the localhost language as Standard English .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM