Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to debug browser driver issues #96

Open
ThomasLandauer opened this issue Apr 24, 2022 · 3 comments
Open

Document how to debug browser driver issues #96

ThomasLandauer opened this issue Apr 24, 2022 · 3 comments

Comments

@ThomasLandauer
Copy link
Member

@Naktibalda If webdriver isn't getting a connection to the browser, is there a way to debug the interplay between the involved components: Codeception <-> Facebook WebDriver <-> chromedriver <-> chrome?
I.e. is there a way to "ping" Facebook WebDriver from Codeception? Then ping chromedriver, etc.?

@Naktibalda
Copy link
Member

Facebook WebDriver (now PHP WebDriver - https://github.com/php-webdriver/php-webdriver) is PHP library, there is nothing to ping.

If ChromeDriver is not reachable, you get ConnectionException Can't connect to WebDriver at localhost:4444. Make sure that ChromeDriver, GeckoDriver or Selenium Server is running. on session creation.
If session creation succeeded but some later request fails, you get \Facebook\WebDriver\Exception\WebDriverCurlException.

If ChromeDriver fails to launch Chrome, you get something like Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: Driver server process died prematurely.
See #112 as example.

@ThomasLandauer
Copy link
Member Author

I just spent several hours trying to get ChromeDriver connect with a snap installation of Chromium (default on ubuntu nowadays), and the error message I got was:

[Facebook\WebDriver\Exception\WebDriverException] JSON decoding of remote response failed.
Error code: 4
The response: 'unhandled request'

I'm guessing that ChromeDriver was responding with some error message, and WebDriver wasn't able to parse that.

  1. Is there a way to get the "raw" response from ChromeDriver/Chrome?
  2. All docs regarding ChromeDriver (same with Geckodriver) are using a non-PHP syntax, e.g. https://chromedriver.chromium.org/capabilities So the first problem when trying to debug something is to "translate" what they're telling you into the YAML-syntax that Codeception is expecting: https://codeception.com/docs/modules/WebDriver#ChromeDriver Is there a general rule for this "translation"? Or (even better) is there a way to try these options directly on the command line (i.e. outside of Codeception)?
  3. What are you usually doing when it's not working right away?

=> My plan would be to explain these questions at https://codeception.com/docs/modules/WebDriver

Regarding snap: I came to the conclusion that it's not compatible and installed a deb package of Chromium ;-)

@Naktibalda
Copy link
Member

Yes, Facebook WebDriver is very bad at handling unexpected responses.

Most likely 'unhandled request' is the raw response that you want to get.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants