ddev / ddev-selenium-standalone-chrome

A DDEV service for running standalone Chrome
Apache License 2.0
28 stars 17 forks source link

With Drupal 10.3+: the requested URL returned error: 500 #41

Closed andriokha closed 1 day ago

andriokha commented 2 months ago

Hi,

I'm finding that the latest version of Drupal this works with is 10.2. It seems to be down to #3240792 (see comment #63 onwards).

The following passes when $branch is 10.2.x but fails with 10.3.x.

git clone --depth 1 https://git.drupalcode.org/project/drupal -b $branch
cd drupal
ddev delete -Oy test-drupal || true
ddev config --project-name=test-drupal --php-version=8.1 --web-environment-add SYMFONY_DEPRECATIONS_HELPER=disabled
ddev start -y
ddev composer -n require "drupal/core-dev:^10"
ddev get ddev/ddev-selenium-standalone-chrome
ddev restart
ddev exec "curl -v selenium-chrome:4444/wd/hub/status"
ddev exec -d /var/www/html "vendor/bin/phpunit -v -c ./core/phpunit.xml.dist ./core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php"

As a workaround I'm using https://raw.githubusercontent.com/ddev/ddev-contrib/master/docker-compose-services/drupalci-chromedriver/docker-compose.chromedriver.yaml which uses drupalci/webdriver-chromedriver:production.

Thanks!

andriokha commented 2 months ago

phpunit.log selenium.log

andriokha commented 2 months ago

It appears to be that \WebDriver\WebDriver::session() is checking for the w3c flag one level higher up than where it was being set, so it was using the W3C dialect, which won't be supported until #3421202 lands. Using the following worked for me:

[\"chrome\", {\"browserName\":\"chrome\",\"w3c\":false,\"goog:chromeOptions\":{\"args\":[\"--disable-gpu\",\"--headless\", \"--no-sandbox\", \"--disable-dev-shm-usage\"]}}, \"http://selenium-chrome:4444/wd/hub\"]
rfay commented 2 months ago

Does that mean this gas nothing to do with this repo?

andriokha commented 2 months ago

I'm not sure I'm afraid. It seems to me either the config in this repo is wrong (and would be fixed with this change), or the new library being used (lullabot/php-webdriver) is looking in the wrong place. I can't find any reference on the matter (this is a flag to switch between two different standards, so I guess it isn't in either standard itself). It's not mentioned as a chrome capability here and it doesn't to my mind make much sense as a browser-specific capability. Quickly looking at some other webdrivers (ie I could easily have missed something) it seems that Facebook's driver automatically detects dialect, so I guess no flag needed; and instaclick's version seems to infer w3c mode from whether any capabilities are passed at all (which makes no sense to me!).

So yeah, not much help overall! I pinged this issue where I expect bigger brains will weigh in (:

thijsboots commented 1 month ago

Thank you for posting that fix, @andriokha! Works perfectly on my machine.

penyaskito commented 1 month ago

Had the same issue, changing .ddev/config.selenium-standalone-chrome.yaml as suggested fixed it for me (working on contrib with 10.3.x HEAD)

simesy commented 3 weeks ago

This change also fixed for me. ddev v1.23.1, Drupal 10.3, seleniarm/standalone-chromium:4.1.4-20220429

simesy commented 3 weeks ago

I'm guessing this needs to be updated to a new image https://github.com/ddev/ddev-selenium-standalone-chrome/blob/main/docker-compose.selenium-chrome.yaml#L9

This core issure https://www.drupal.org/project/drupal/issues/3421202 is proposing 4.17 which is a couple of months old, versus this one is 2 years old.

weitzman commented 3 weeks ago

That upgrade has stalled. See #42

slashrsm commented 4 days ago

Changing MINK_DRIVER_ARGS_WEBDRIVER as proposed by @andriokha fixes this issue for me. Would it be possible to pull this fix upstream?

andriokha commented 2 days ago

See also https://github.com/Lullabot/php-webdriver/pull/10/files

andriokha commented 2 days ago

And this which IIUC is an alternative to PR 10 above: https://www.drupal.org/i/3458751

andriokha commented 1 day ago

OK the PR for lullabot/php-webdriver got merged in. If some kind soul with perms could rerun the tests, with a bit of luck we'll be able to close this issue I think.

rfay commented 1 day ago

Tests are green now, https://github.com/ddev/ddev-selenium-standalone-chrome/actions

andriokha commented 1 day ago

Nice, thanks @rfay!