Pooja
Pooja

Reputation: 1

Chrome Browser terminates immediately after getting launched through selenium webdriver

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

Upvotes: 0

Views: 2199

Answers (1)

Edgar J.
Edgar J.

Reputation: 172

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();

Upvotes: 1

Related Questions