When I create a new chrome driver in Selenium while Google Chrome is already running AND I am referencing the users settings/data (via user-data-dir). A new Chrome window will open, but my application will hang. The ChromeDriver console will display the following error each second:
DevTools Request: 127.0.0.1:12585/json/version. DevTools request failed
This will work perfectly fine in every time if I do not try and load user settings/data. If I am trying to load user setting/data it will only work if there is no instance of Chrome running on the device already.
I am not sure if this is a bug, or my own ignorance. Hopefully the later.
Versions:
Possibly related to: https://github.com/angular/protractor/issues/1636 ?
Edit: code snippet for reference:
ChromeDriverService driverService = ChromeDriverService.CreateDefaultService();
//driverService.HideCommandPromptWindow = true;
driverService.EnableVerboseLogging = true;
string path = Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%\\Google\\Chrome\\User Data");
ChromeOptions options = new ChromeOptions();
options.AddArguments("user-data-dir=" + path);
options.AddArguments("--start-maximized");
options.AddArguments("--disable-extensions");
IWebDriver driver = new ChromeDriver(driverService, options);
chromedriver issues are tracked on a separate project, please log issues there:
Its almost 8 months since the problem was closed, but I would like to shed some light into issue and possibly provide a solution to some else who may run into this issue.
Refer to http://stackoverflow.com/a/22735763/2326198 and setup the output log for the Chrome webdriver as mentioned in that post.
After that execute the code that was giving you issue and you will see the reason of failure.
In my case it was ' Gtk: cannot open display'.
HTH,
@kpcool I'm having the same issue - could you possibly post how you fixed it please?
for anyone having problem with codeception and headless chrome, this will save your day:
http://phptest.club/t/how-to-run-headless-chrome-in-codeception/1544
Launch With Selenium Server
Selenium Server should be started:
java -jar ~/selenium-server.jar
And the following config to launch Chrome headlessly:
modules:
config:
WebDriver:
browser: chrome
window_size: false
capabilities:
chromeOptions:
args: ["--headless", "--disable-gpu"]
binary: "/usr/bin/google-chrome"
Valid path to google chrome executable should be set in binary. It must be path to Chrome >= 59+
Launch using ChromeDriver only, without Selenium Server
ChromeDriver v 2.30+ should be installed in global path. Launch it:
chromedriver --url-base=/wd/hub
Use following config to run tests using ChromeDriver, without connecting to Selenium Server:
modules:
config:
WebDriver:
browser: chrome
port: 9515 # ChromeDriver port
window_size: false
capabilities:
chromeOptions:
args: ["--headless", "--disable-gpu"]
binary: "/usr/bin/google-chrome"
Limitations
Headless Chrome does not support (yet):
changing window size (resizeWindow command and window_size config option will throw exceptions)
alerts and popups (acceptPopup, cancelPopup, etc will throw exceptions)
If you need to set initial window size for window-size option to chrome args:
capabilities:
chromeOptions:
args: ["--headless", "--disable-gpu", "window-size=1920x1080"]
Most helpful comment
Its almost 8 months since the problem was closed, but I would like to shed some light into issue and possibly provide a solution to some else who may run into this issue.
Refer to http://stackoverflow.com/a/22735763/2326198 and setup the output log for the Chrome webdriver as mentioned in that post.
After that execute the code that was giving you issue and you will see the reason of failure.
In my case it was ' Gtk: cannot open display'.
HTH,