Context:
- Windows 10 Home;
- Visual Studio 2015 Community;
- C#;
- NSSM;
- ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129);
- Nuget package Selenium.WebDriver.2.53.1;
- Nuget package Selenium.WebDriver.ChromeDriver.2.23.0.1
I have used NSSM to create a Windows Service wrapping chromedriver.exe, with the following settings:
Path: c:\bin\chromedriver.exe
Startup Directory: c:\bin
Arguments: --port=12942 --log-path=c:\temp\chromedriver.log --verbose
Service Name: ChromeDriverService
In VS2015Community I've created a C# app as follows:
var uri = new Uri("http://localhost:12942");
DesiredCapabilities dc = DesiredCapabilities.Chrome();
ChromeOptions options = new ChromeOptions();
options.BinaryLocation = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe";
options.LeaveBrowserRunning = true;
dc.IsJavaScriptEnabled = true;
IWebDriver driver = new RemoteWebDriver(uri, dc);
When I step through the program, I get a The HTTP request to the remote WebDriver server for URL http://localhost:12942/session timed out after 60 seconds.
on the new RemoteWebDriver
line.
In the c:\temp\chromedriver.log
I get the following:
[44.717][INFO]: COMMAND InitSession {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"platform": "ANY",
"version": ""
}
}
[66.168][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
}
}
[66.171][INFO]: Populating Local State file: {
"background_mode": {
"enabled": false
},
"ssl": {
"rev_checking": {
"enabled": false
}
}
}
[68.099][INFO]: Can not set to US keyboard layout - Some keycodes may beinterpreted incorrectly
[68.099][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-component-extension="C:\WINDOWS\TEMP\scoped_dir5436_17406\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12772 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir="C:\WINDOWS\TEMP\scoped_dir5436_20664" data:,
[68.127][DEBUG]: DevTools request: http://localhost:12772/json/version
[70.154][DEBUG]: DevTools response: {
"Browser": "Chrome/52.0.2743.116",
"Protocol-Version": "1.1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
"WebKit-Version": "537.36 (@9115ecad1cae66fd5fe52bd9120af643384fd6f3)"
}
[70.155][DEBUG]: DevTools request: http://localhost:12772/json
[70.168][DEBUG]: DevTools response: [ ]
... a minute's worth of the above two lines removed ...
[128.264][INFO]: RESPONSE InitSession unknown error: unable to discover open pages
[128.264][DEBUG]: Log type 'driver' lost 0 entries on destruction
[128.264][DEBUG]: Log type 'browser' lost 0 entries on destruction
I have a distant memory of having successfully talked to an NSSM-wrapped chromedriver.exe earlier this year. I can't find the code now. What am I missing here?