Invalid port. Exiting...
?????? ??, ???? ??:??:?? ??????? org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'PRAVUDHAS', ip: '192.168.43.15', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:202)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:188)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
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.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at AlertClass.main(AlertClass.java:14)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:?????/status] to be available after ????? ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:197)
... 9 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 10 more
最佳答案
Download the latest ChromeDriver for your operating system here.
升级ChromeDriver。
通过CLI执行netstat命令以查看是否已达到可能打开的限制
连接或检查给定端口上是否正在运行其他应用程序。
设置驱动程序路径。
检查您的防火墙设置,有可能防火墙配置可能是
引起问题。
关于java - 在运行简单的selenium + java代码时出现异常?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/61066507/