Reputation: 47
i am using Codeception for acceptance testing. On my local pc i have no problems to run the tests with selenium and chromedriver. Until 1 week, it works also fine at my git, but now, there comes this error.
"[PHPUnit\Framework\Exception] Undefined index: ELEMENT"
local it is working fine without errors.
I already searched this error and found an tip, that i have to start selenium with "-enablepassthrough false". But this does not really works.
Before 1 week with all the same setup, it works fine.
this is my acceptance.suite.yml:
actor: AcceptanceTester
modules:
enabled:
- WebDriver:
url: 'https://website.com'
host: 'selenium__standalone-chrome'
port: 4444
browser: chrome
window_size: 1920x1080
Upvotes: 4
Views: 2964
Reputation: 1395
For Chrome/ChromeDriver v79 setting w3c
to false
in acceptance.suite.yml
helped:
modules:
enabled:
- WebDriver:
capabilities:
chromeOptions:
w3c: false
Upvotes: 3
Reputation: 604
As @DebanjanB explained, setting the said option is a solution and this is what you get by updating facebook/php-webdriver to version >= 1.7.0
I think an even more solid solution (or habit) for your application is to use a specific docker image.
Your yaml makes me guess that you're using the selenium/standalone-chrome
docker image. With their latest release (3.141.59-palladium
) they updated the included Chrome version from 74
to 75
(see: https://github.com/SeleniumHQ/docker-selenium/releases).
Your local machine probably still runs an older version with Chrome 74 so no problems there. But whenever you rebuild the docker machine (e.g. when using some CI environment) you get the latest version. In this case a new Chrome version. Which "forces" you to also upgrade your php machine with a new facebook/php-webdriver.
I'd suggest to specify a version of the image to prevent these unwanted side effects, like
image: selenium/standalone-chrome:3.141.59-oxygen
or, if you've already made it run with Chrome 75, 3.141.59-palladium
.
Upvotes: 0
Reputation: 193258
This error message...
[PHPUnit\Framework\Exception] Undefined index: ELEMENT
...implies that the ChromeDriver's click()
through Codeception is having an issue.
As per @reinholdfuereder's comment within the discussion facebook/php-webdriver - W3C WebDriver protocol support:
Undefined index: ELEMENT
in waitForElement()
operation.waitForElement()
operation, which is followed by a seemingly also successful click()
operation, but fails in the waitForElementNotVisible()
operation.click()
operation is translated into clickElement
WebDriver command that is seemingly no more supported by ChromeDriver v75.If you are using ChromeDriver v75.x and Chromium v75.x and you are seeing this error, you need to pass an additional chromeOptions w3c
set to true
.
You can find a couple of detailed discussion in:
Upvotes: 2