New issue
Advanced search Search tips
Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jul 12



Sign in to add a comment

Headless Chrome 67 with Chromedriver 2.40: DevToolsActivePort file doesn't exist

Reported by nakeri...@gmail.com, Jun 26

Issue description

Issue Description:
I have automated Selenium Java (3.12.0)/TestNG tests which start from an Ant script started by a service and are supposed to run in a headless browser. To simplify Chromedriver installation and configuration, I use the WebDriverManager library from https://github.com/bonigarcia/webdrivermanager (v2.2.3), which simply downloads the driver, places it in the correct location and configures the relevant properties. These tests run on a Windows 2008 R2 machine (Yeah, I know, old OS, we're working on replacing it).

The problem I have is that with the Chrome and ChromeDriver version stated in the summary, I get the "DevToolsActivePort file doesn't exist" error in my log and Chrome/Chromedriver stay active in my processes list.

Steps to reproduce (if relevant, you MUST provide a simplified html page or
link to public site):
Java code which creates the driver:

ChromeDriverManager.getInstance().setup();
			// webDriver = new ChromeDriver();
			ChromeOptions chromeOptions = new ChromeOptions();
			chromeOptions.setHeadless(true);
			chromeOptions.addArguments("--disable-dev-shm-usage");
			chromeOptions.addArguments("--no-sandbox");
			ChromeDriverService chromeService = new Builder().withVerbose(true)
					.withLogFile(new File("D:\\chromedriver.log")).build();
			webDriver = new ChromeDriver(chromeService, chromeOptions);

The code above breaks on the last line. It also breaks if I remove the ChromeDriverService declaration.


-----Other helpful tips:
Attach your chromedriver log with verbose logging enabled (see
http://goo.gl/5Sx8mC for how to do this).
See attachment
 
chromedriver.log
3.4 KB View Download
Labels: Needs-Feedback
Could you please try to run from cmd console the following command to see if chrome launches?

C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage --disable-gpu --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --headless --ignore-certificate-errors --load-extension="C:\Windows\system32\config\systemprofile\AppData\Local\Temp\scoped_dir8348_19383\internal" --log-level=0 --metrics-recording-only --no-first-run --no-sandbox --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Windows\system32\config\systemprofile\AppData\Local\Temp\scoped_dir8348_29722"

If you can launch chrome from cmd console then I would advice you to use ProcMon tool to monitor Chrome and Chromdriver processes.
The problem might be related to some security restrictions are applied to the service you are trying to run.


Running that command from cmd opens a number of Chrome processes in task manager and gives the response:

C:\Users\USERNAME>[0627/140433.710:ERROR:gpu_process_transport_factory.cc(101
7)] Lost UI shared context.

DevTools listening on ws://127.0.0.1:56035/devtools/browser/a96494ec-c668-41de-b
d32-edd4041703a7

When starting chrome through the ChromeDriver, the processes also opened successfully in the task manager, and ending the Chromedriver Process Tree through taskmanager also successfully ended all chrome processes opened by the chromedriver.
You are saying "When starting chrome through the ChromeDriver, the processes also opened successfully", do you see if Chrome actually launched on your machine?

From the Chromedriver verbose logs you have attached in here I see it was failed, so in this case you should not see if Chrome was launched.


Actually I was wrong saying "do you see if Chrome was launched" because you are running in headless mode. Sorry about that.

I would suggest you to use ProcMon tool P to check if Chrome attempted to create DevToolsActivePort file.
Also you can take a look at System Events logs.


This is just a thought and I haven't verified it yet, but is it possible that because the ChromeDriver is starting Chrome with the user-data-dir (and thus the DevToolsActivePort file) location set to --user-data-dir="C:\Windows\system32\config\systemprofile\AppData\Local\Temp\scoped_dir8348_29722", Chromedriver doesn't have access to the file because of permissions? I don't know if the ChromeDriver can access that directory by default, since it's nested deep within system32.
Project Member

Comment 7 by johnchen@chromium.org, Jun 28

The user-data-dir path is located in the temp directory associated with the ChromeDriver process, and in a properly configured system every process should have access to its own temp directory. Many apps would break if the temp directory isn't accessible.

Tools like ProcMon, as suggested in comment #5, provide a good way to verify if access permission is the cause of the problem.
Hi John,

I am facing the same issue while running selenium tests to automate openFin application. As suggested by you , I monitored chrome in ProcMon and found that it isn't creating the DevToolsActivePort file. Please suggest if I have to open a new issue for this.

Thanks!
Project Member

Comment 9 by johnchen@chromium.org, Jul 9

Hi pachisia...@gmail.com,

Since your case sounds similar to this issue, please feel free to add your comments to this issue instead of opening a new one. Here are some questions for you:

* Which version of Chrome do you have installed?
* How are you starting ChromeDriver and Chrome?
* If possible, could you save the ProcMon trace in a file and attach it to this issue?

Thanks!
Hi John,

I am using Chrome Version 67.0.3396.99. I manually start my chrome driver(2.40) before running the below script. The below script is used to make connection between openFin application and chromedriver. I am using a batch file (RunOpenFinn.bat) for launching OpenFin Runtime by ChromeDriver. It parses --remote-debugging-port and --config parameters passed by ChromeDriver and passes them to OpenFinRVM.exe. Note: Config.json is the config file of our OpenFin application. I am attaching RunOpenFinn.bat, config.json file and Procmon log file.

String execPath = System.getProperty("user.dir") + "\\drivers\\RunOpenFinn.bat";// path to OpenFinRVM.exe
String execArgs = "--config=" + System.getProperty("user.dir") + "\\drivers\\config.json"; 
String remoteDriverURL = "http://localhost:9515"; // URL to Selenium server or chromedriver

		WebDriver driver;
		ChromeOptions options = new ChromeOptions();
		options.setBinary(execPath);
		options.addArguments(execArgs);
		options.addArguments("--headless");
		options.addArguments("--disable-dev-shm-usage");
		options.addArguments("--no-sandbox");		
		DesiredCapabilities capabilities = DesiredCapabilities.chrome();
		capabilities.setCapability(ChromeOptions.CAPABILITY, options);
		driver = new RemoteWebDriver(new URL(remoteDriverURL),capabilities);
Attaching files
Logfile.CSV
2.3 MB View Download
config.json
1.0 KB View Download
RunOpenFinn.bat
916 bytes View Download
Project Member

Comment 12 by johnchen@chromium.org, Jul 10

Re comments #10 and #11: I haven't seen OpenFin before, and don't have any experience with it. Here are a few things that might be causing the issues:

* How was chrome started? Normally, ChromeDriver is responsible for starting Chrome. In your case, however, ChromeDriver started OpenFin instead of Chrome, and from the log Chrome was started before OpenFin (OpenFin started at "11:29:41.0614408 AM", while Chrome was already running at "11:29:09.2486265 AM", and probably even earlier.

* One important switch from ChromeDriver to Chrome is --user-data-dir switch, which tells Chrome where to create DevToolsActivePort file. Since your RunOpenFinn.bat doesn't look for this flag, it would be lost. In any case, since Chrome has already started by the time ChromeDriver runs RunOpenFinn.bat, it's too late to pass the --user-data-dir switch to Chrome.

Probably the right solution is to start Chrome from RunOpenFinn.bat, passing all the switches from ChromeDriver to Chrome.
Re comment #12: Please note that chrome which you think was already started were just few tabs already opened. However I never saw chrome browser starting when I run my script. Only chrome driver is in picture.  Also , I am not sure how but my same code/configs used to work perfectly well before the chrome browser auto upgrade to version 67.0.3396.99.

I have closed all chrome browser, chrome driver and OpenFin instances and ran my script again with minor change where in I need not start chromedriver manually before running script. Please find attached the Procmon Logs.


System.setProperty("webdriver.chrome.driver", "C:\\Users\\mpachi\\workspace\\openFinDemo\\drivers\\2.40\\chromedriver.exe");
String execPath = System.getProperty("user.dir") + "\\drivers\\RunOpenFinn.bat"; // path to OpenFinRVM.exe
String execArgs = "--config=" + System.getProperty("user.dir") + "\\drivers\\config.json"; 
		WebDriver driver;
		ChromeOptions options = new ChromeOptions();
		options.setBinary(execPath);
		options.addArguments(execArgs);
		options.addArguments("--headless");
		options.addArguments("--disable-dev-shm-usage");
		options.addArguments("--no-sandbox");		
		DesiredCapabilities capabilities = DesiredCapabilities.chrome();
		capabilities.setCapability(ChromeOptions.CAPABILITY, options);	
		driver=new ChromeDriver(options);

Logfile2.CSV
2.1 MB View Download
Project Member

Comment 14 by johnchen@chromium.org, Jul 11

Hi pachisia...@gmail.com,

Normally, ChromeDriver starts Chrome and then connects to it. In your case, you used options.setBinary to configure ChromeDriver to run RunOpenFinn.bat instead. The batch file starts OpenFinRVM.exe, not Chrome. So I am not sure which app is supposed to start Chrome? Is OpenFinRVM.exe supposed to start Chrome? Without Chrome, there is nothing for ChromeDriver to drive.
Hi John,

Thanks for explaining. On researching more I found that it is an issue with OpenFin. They are working on this. 


Labels: -Needs-Feedback
Status: WontFix (was: Unconfirmed)
Thank you for the update. We are closing this bug.

Comment 17 by nakeri...@gmail.com, Sep 26 (5 days ago)

So just for clarity: Pachisia's issue is fixed, but my problem (as the issue creator) hasn't been fixed yet (which is why I think it's weird to close this issue as WontFix). However, I'm currently working on other elements of my software. Once I'm able to return to the ChromeDriver testing part of my software, can I still use this issue to continue asking for support, or do you recommend I open a new issue?

Comment 18 by khachatryan@chromium.org, Sep 26 (4 days ago)

nakerikan.... no you don't need to open a new bug, simply please let us know if you have additional information that can help us to reproduce the issue.

If you are running on Windows machine please download 'procmon' tool from https://docs.microsoft.com/en-us/sysinternals/downloads/procmon and monitor Chrome process. Please make sure you are monitoring the Chrome whichever your application launched. Make sure Chrome was not crashed and it created DevToolsActivePort file on your machine.

Sign in to add a comment