Reputation: 1
Source code:
package Labarary;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class LAb {
public static void main(String[] args) {
System.out.println("chrome");
System.setProperty("webdriver.chrome.driver","C:\\Users\\Manjit\\Downloads\\chromedriver_win32\\chromedriver.exe");
// TODO Auto-generated method stub
WebDriver driver=new ChromeDriver();
}
}
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.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z' System info: host: 'MANJIT-PC', ip: '192.168.1.19', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_171' Driver info: driver.version: ChromeDriver at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:130) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at Labarary.LAb.main(LAb.java:20) 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:187) ... 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:148) at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75) ... 10 more
Upvotes: 0
Views: 1341
Reputation: 193358
This error message...
Invalid port. Exiting... ??? ??, ???? ??:??:?? ???????
org.openqa.selenium.os.OsProcess checkForError
...implies that the OsProcess is unable to bind the ChromeDriver server process to the assigned free port within your system.
As per the discussion Getting Invalid port error and Invalid port. Exiting...
"Invalid port. Exiting..." occurs when the port assigned to chromedriver is less than 0 or greater than 65535.
Perform the following steps to address the core issue:
netstat
command through CLI to see if you have reached limit of possible open connections or check if there is another application running on the port used by ChromeDriver.@Test
as non-root user.driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.As an alternative you can force the WebDriver variant i.e. ChromeDriver to start on a specific port e.g. 65535
as follows:
Code Block:
System.setProperty("webdriver.chrome.driver","C:\\WebDrivers\\chromedriver.exe");
WebDriver driver= new ChromeDriver(new ChromeDriverService.Builder().usingPort(65535).build());
driver.get("https://www.google.com/");
Console Output:
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 65535
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Jul 20, 2020 7:36:17 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
You can find a couple of relevant detailed discussions in:
Upvotes: 0