2

I just start learning Selenium, but it seems that my chromedriver version is incompatible with my current chrome version? Any helps will be appreciated

The following is the error message I got:

Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1556601048.968][SEVERE]: Unable to receive message from renderer
org.openqa.selenium.SessionNotCreatedException: session not created
from disconnected: Unable to receive message from renderer
  (Session info: chrome=74.0.3729.108)
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17763 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 17.07 seconds
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:28.403Z'

my original code:

 package com.selenium.webdriver.basic;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class First {
    /**
     * webdriver is a thing where all my functions are
     * which is going to control the browser 
     * and manages the functions which will let me the browser's property
     */
    WebDriver driver;   


    public void invokeBrowser() {
        try {
            System.setProperty("webdriver.chrome.driver", "C:\\Selenium_tutorial\\chromedriver_win32\\chromedriver.exe");
            driver = new ChromeDriver();  //instantiate your chrome driver
            driver.manage().deleteAllCookies();//use driver as object reference
        //  driver.manage().window().maximize(); //always minimize by default

            //bait synchronization. always need this 
            driver.manage().timeouts().implicitlyWait(3600, TimeUnit.SECONDS); //element detection timeout
            driver.manage().timeouts().pageLoadTimeout(3600, TimeUnit.SECONDS);


            driver.get("https://www.google.ca/");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        First myObj = new Fisrt();
        myObj.invokeBrowser();

    }

}
Kerry Ren
  • 21
  • 1
  • 3
  • Please add your selenium code that initialized the driver to the original post. It's possible that you're merely missing ChromeOptions. Mention my name in a tagged response or I may not see your updated post. – Bill Hileman Apr 30 '19 at 19:40
  • @BillHileman I have posted my original code. Please tell me if there are any errors. – Kerry Ren Apr 30 '19 at 21:50

1 Answers1

0

This would work as-is with older versions of Selenium, but you should add one line and modify another to use ChromeOptions. I'm doing this "air code" so it might not be 100% accurate:

ChromeOptions option = new ChromeOptions();
driver = new ChromeDriver(options);

You should be prompted by your IDE to include the library for ChromeOptions, I don't know what it is off the top of my head or I'd include that for you, too.

Also, while page and element timeouts are important, you're setting both to one hour - way too long for a timeout failure. I recommend setting them to something more realistic, like 15 to 30 seconds.

Bill Hileman
  • 802
  • 7
  • 10
  • sorry. i tried your solution. it's still not working. and I have tried different chrome versions and eclispe version. they still give me the same error – Kerry Ren May 02 '19 at 06:41