0

I have installed the following versions to use selenium with chrome. The chrome browser is getting launched and opens the required url but immediately gets terminated and the window closes within few secs. Please guide me on any changes I need to do.

Versions: Chrome:78.0.3904.108 Chrome Driver:78.0.3904.105 Selenium:selenium-java-3.141.59 Java:jdk-8u231-windows-x64


Code:

System.setProperty("webdriver.chrome.driver","C:\\Users\\Pooja\\Desktop\\ChromeDriver\\chromedriver.exe);

WebDriver driver = new ChromeDriver();

driver.get("https://selenium.dev");

System.out.println(driver.getTitle());

driver.quit();

Output in console after execution:

Starting ChromeDriver 78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}) on port 1226 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. [1574867082.995][WARNING]: Timed out connecting to Chrome, retrying... Nov 27, 2019 10:04:45 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C SeleniumHQ Browser Automation

CEH
  • 5,701
  • 2
  • 16
  • 40
Pooja
  • 1
  • 1
  • This might help: https://stackoverflow.com/questions/55069656/please-protect-ports-used-by-chromedriver-and-related-test-frameworks-to-prevent – CEH Nov 27 '19 at 15:32

1 Answers1

1

I tried this using the same versions of Google chrome and the Chrome driver and it works for me. The issue is that you missed a quotation mark at then end of your driver path.

Hope this helps

System.setProperty("webdriver.chrome.driver","C:\\Users\\edgar\\Downloads\\chromedriver_win32\\chromedriver.exe");

        WebDriver driver = new ChromeDriver();

        driver.get("https://selenium.dev");

        System.out.println(driver.getTitle());

        driver.quit();
Edgar J.
  • 132
  • 1
  • 12
  • Thank you Edgar...However after adding the quotation mark also chrome crashes – Pooja Nov 28 '19 at 03:31
  • System.setProperty("webdriver.chrome.driver","C:\\Users\\Pooja\\Desktop\\ChromeDriver\\chromedriver.exe"); – Pooja Nov 28 '19 at 03:32
  • Are you using the same version as mine of selenium also? – Pooja Nov 28 '19 at 03:32
  • Yeah I tried the same version of Selenium and Chrome. Are you getting the same error? – Edgar J. Dec 02 '19 at 04:01
  • thanks Edgar....I realized it was the driver.quit (); statement in the code which was causing the browser to close. When I removed it ...it worked fine... – Pooja Dec 03 '19 at 16:30