WebDriver cannot connect to a CEF app (DevToolsActivePort file doesn't exist) |
|||||
Issue descriptionChrome Version: CEF based app (//third_party/cef) Driver info: chromedriver=2.39.562718 OS: Vanadium VM running Windows 7 image (Windows NT 6.1.7601 SP1 x86) What steps will reproduce the problem? Run WebDriver test that tries to connect to CEF app. More info here: https://yaqs.googleplex.com/eng/q/5067870936760320 Sponge link: http://sponge/c0becfeb-95ad-47ee-855c-8056d1dbf391 What is the expected result? WebDriver test should run with no issues, if Chrome is used instead of a CEF app, test actually succeeds. What happens instead? ChromeDriver cannot connect to the CEF app. The test errors out with "DevToolsActivePort file doesn't exist" Please use labels and text to provide additional information. If this is a regression (i.e., worked before), please consider using the bisect tool (https://www.chromium.org/developers/bisect-builds-py) to help us identify the root cause and more rapidly triage the issue. For graphics-related bugs, please copy/paste the contents of the about:gpu page at the end of this report.
,
Jul 12
,
Jul 12
Sponge link: http://sponge/c0becfeb-95ad-47ee-855c-8056d1dbf391 I will try using the latest ChromeDriver version, I don't know how to change this but will ask in webdriver-users
,
Jul 12
,
Jul 13
I read the CEF code, and basically CEF does not currently support the functionality that ChromeDriver needs. I filed a bug against them here with a ton of details: https://bitbucket.org/chromiumembedded/cef/issues/2476/cef-does-not-support-remote-debugging-port If you want a quick and dirty solution, you can write a wrapper script for CEF that gets passed as the binary in ChromeOptions. The script would do the following: 1. Parse --user-data-dir argument as DIR. 2. Pick a random free port as PORT 3. Write the free port to $DIR/DevToolsActivePort (see formatting info on the other bug) 4. exec the real CEF with all the same arguments except with the --remote-debugging-port=0 argument changed to --remote-debugging-port=$PORT Note that for #4 it is important to exec CEF rather that start a CEF subprocess. This is because ChromeDriver depends on being able to check the state of the browser process, and it the browser process exits then ChromeDriver assumes that it has crashed. It is also helpful so ChromeDriver can kill the browser process if need be.
,
Jul 13
But it would be better to fix the CEF code itself rather than using the hacky wrapper script.
,
Jul 13
I spoke in detail with John about this problem. We decided that we would rather not force Chromium derivative apps like CEF and Electron to write the DevToolsActivePort file. Instead, the plan is to allow users to pass in --remote-debugging-port=<PORT> and for us to use that instead. This will require them to start using that flag, but that should not be a very difficult change. Now I will dig into the code for this.
,
Jul 13
Regarding this specific problem. I have my test working by doing this hack: cl/204523402 Thanks for your help Caleb!
,
Jul 16
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/80104bfcec5f4544b8e14538bdb00451995750c8 commit 80104bfcec5f4544b8e14538bdb00451995750c8 Author: Caleb Rouleau <crouleau@chromium.org> Date: Mon Jul 16 20:35:15 2018 [ChromeDriver] Allow user-defined remote-debugging-port. Chromium Embedded Framework sometimes uses an in-memory user-data-dir, so the DevToolsActivePort file is not a viable option for them. We think it is likely that other Chromium variants, present or future, may have trouble with the DevToolsActivePort file, so this should make things easier for them. Also, fix testConnectToRemoteBrowser to 1. Have retries so it passes in the case of a race condition for port allocation. 2. Prevent a race with Chrome during teardown. -- Note that this race was causing the user-data-dir to not be deleted at the end. Bug: 863247 Change-Id: I506be26fc2e282b7194afd88afd02efcec65e880 Reviewed-on: https://chromium-review.googlesource.com/1137440 Commit-Queue: Caleb Rouleau <crouleau@chromium.org> Reviewed-by: John Chen <johnchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#575408} [modify] https://crrev.com/80104bfcec5f4544b8e14538bdb00451995750c8/chrome/test/chromedriver/chrome_launcher.cc [modify] https://crrev.com/80104bfcec5f4544b8e14538bdb00451995750c8/chrome/test/chromedriver/test/run_py_tests.py [modify] https://crrev.com/80104bfcec5f4544b8e14538bdb00451995750c8/chrome/test/chromedriver/util.py
,
Jul 16
This should be fixed and released in ChromeDriver 2.41. Not sure when exactly when will release 2.41 though. Once this is out, the solution is to add argument --remote-debugging-port=<PORT> to chrome options that are passed in when creating the driver. See reference: http://chromedriver.chromium.org/capabilities
,
Jul 20
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e1900fcf6f18caff57faf059b368e9c2f93edd2c commit e1900fcf6f18caff57faf059b368e9c2f93edd2c Author: Caleb Rouleau <crouleau@chromium.org> Date: Fri Jul 20 17:57:58 2018 [ChromeDriver] Allow user-defined remote-debugging-port. Chromium Embedded Framework sometimes uses an in-memory user-data-dir, so the DevToolsActivePort file is not a viable option for them. We think it is likely that other Chromium variants, present or future, may have trouble with the DevToolsActivePort file, so this should make things easier for them. Also, fix testConnectToRemoteBrowser to 1. Have retries so it passes in the case of a race condition for port allocation. 2. Prevent a race with Chrome during teardown. -- Note that this race was causing the user-data-dir to not be deleted at the end. TBR=crouleau@chromium.org Bug: 865982 , 863247 Change-Id: I506be26fc2e282b7194afd88afd02efcec65e880 Reviewed-on: https://chromium-review.googlesource.com/1137440 Commit-Queue: Caleb Rouleau <crouleau@chromium.org> Reviewed-by: John Chen <johnchen@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#575408}(cherry picked from commit 80104bfcec5f4544b8e14538bdb00451995750c8) Reviewed-on: https://chromium-review.googlesource.com/1145560 Cr-Commit-Position: refs/branch-heads/3440@{#729} Cr-Branched-From: 010ddcfda246975d194964ccf20038ebbdec6084-refs/heads/master@{#561733} [modify] https://crrev.com/e1900fcf6f18caff57faf059b368e9c2f93edd2c/chrome/test/chromedriver/chrome_launcher.cc [modify] https://crrev.com/e1900fcf6f18caff57faf059b368e9c2f93edd2c/chrome/test/chromedriver/test/run_py_tests.py [modify] https://crrev.com/e1900fcf6f18caff57faf059b368e9c2f93edd2c/chrome/test/chromedriver/util.py
,
Aug 2
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by crouleau@chromium.org
, Jul 12