I need help with setting up ChromeDriver in Selenium WebDriver.
I have downloaded the latest version of ChromeDriver and added the path to the exe to my PATH environment variable. Trying to run the following piece of code to set a new instance of ChromeDriver:
File file = new File("C:\\eclipse\\chromedriver.exe");
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
System.setProperty("webdriver.chrome.logfile", "C:\\eclipse\\chromedriver.log");
driver = new ChromeDriver();
driver.get("google.com");
However, when I try to run any scripts they fail on the line
driver = new ChromeDriver();An instance of Chrome opens with a black screen and the address set as "data;," and I get a popup stating:
"Chrome Automation Extension has crashed".
Continuing from that point, I get the following exception details:
unknown error: unable to discover open pages
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 61.19 seconds
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:03:33'
As I say, I've got the latest version of ChromeDriver and I have checked that Chrome is currently running the latest version so I know it isn't an issue with outdated versions of either.
I'm sure it must be something simple which I'm overlooking, but I just can't think what. Does anyone have any ideas?
Here's the log for the case:
[0.885][INFO]: COMMAND InitSession {
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions": {
"args": [ ],
"extensions": [ ]
},
"platform": "ANY",
"version": ""
}
}
[0.886][INFO]: Populating Preferences file: {
"alternate_error_pages": {
"enabled": false
},
"autofill": {
"enabled": false
},
"browser": {
"check_default_browser": false
},
"distribution": {
"import_bookmarks": false,
"import_history": false,
"import_search_engine": false,
"make_chrome_default_for_user": false,
"show_welcome_page": false,
"skip_first_run_ui": true
},
"dns_prefetching": {
"enabled": false
},
"profile": {
"content_settings": {
"pattern_pairs": {
"https://*,*": {
"media-stream": { "audio": "Default", "video": "Default"
}
}
}
},
"default_content_setting_values": {
"geolocation": 1
},
"default_content_settings": {
"geolocation": 1,
"mouselock": 1,
"notifications": 1,
"popups": 1,
"ppapi-broker": 1
},
"password_manager_enabled": false
},
"safebrowsing": {
"enabled": false
},
"search": {
"suggest_enabled": false
},
"translate": {
"enabled": false
}
}
[0.889][INFO]: Populating Local State file: {
"background_mode": {
"enabled": false
},
"ssl": {
"rev_checking": {
"enabled": false
}
}
}
[0.936][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-logging --ignore-certificate-errors --load-extension="C:\Users\Rory\AppData\Local\Temp\scoped_dir10152_5411\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12607 --safebrowsing-disable-auto-update --safebrowsing-disable-download-protection --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\Rory\AppData\Local\Temp\scoped_dir10152_31299" data:,
[61.070][INFO]: RESPONSE InitSession unknown error: unable to discover open pagesTo view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e10b1718-4ec8-4659-a08e-11fc5cacd991%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
However, the following opens Chrome as a Browser which may help
1. Download the latest Chrome driver installable from http://chromedriver.storage.googleapis.com/index.html
2. Unzip the file and run the Chromedriver.exe file. This should start the Chromedriver on port 9515
3. Install the Chrome Browser
4. In Selenium webdriver create a Class file and use the following code (adjust the location of the Chrome driver as appropriate
package Trainingpack;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class chrome1 {
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.chrome.driver","c:\\ca\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
WebElement searchBox = driver.findElement(By.name("q"));
searchBox.sendKeys(new String[] {"Chrome Driver"});
}
}
You are crashing on the line
driver = new ChromeDriver();--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/6226d44d-55bd-4ae9-ac5b-a8e913bd0c45%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/bc112d77-ed11-4eaf-b161-3ae99140b5eb%40googlegroups.com.