webdriverio: WebdriverIO error out after clicking on a button
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
8.22
Node.js Version
v21.1.0
Mode
Standalone Mode
Which capabilities are you using?
{
browserName: 'chrome',
acceptInsecureCerts: true,
},
What happened?
WebdriverIO errors out after clicking on a button and fails the test. There is no obvious reason for it to fail because I can watch it run the test from the Chrome browser. It clicks on the button (a save button, for example) and the web page saves the form data and navigates to the next expected page. So the click action flow works. However why WebdriverIO errors out.
Sample errors: -Error: Can’t call elementClick on element with selector “.ui-button-text=Create Document” because element wasn’t found
-Error: invalid selector: The selector “” used with strategy “css selector” is invalid! For more information on selectors visit the WebdriverIO docs at: https://webdriver.io/docs/selectors
NOTE: our web app is developed with https://www.primefaces.org/ library and java (). Interestingly hundreds of other buttons in the app work fine with WebdriverIO and only certain buttons would not work. This issue appears to be reproducible more often with Chrome browser. I tried browser.pause() or refresh() page before clicking on the button but not able to resolve the issue.
Any insights would be appreciated. Thanks.
What is your expected behavior?
No response
How to reproduce the bug.
n/a
Relevant log output
Sample errors:
-Error: Can't call elementClick on element with selector ".ui-button-text=Create Document" because element wasn't found
-Error: invalid selector: The selector "" used with strategy "css selector" is invalid! For more information on selectors visit the WebdriverIO docs at: https://webdriver.io/docs/selectors
Code of Conduct
- I agree to follow this project’s Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 32 (14 by maintainers)
FWIW I get the same with Selenium, repro here: https://github.com/slhck/selenium-execution-context-error
Ah, probably you’re right, but this issue was the only one I found when I looked for my error. Sorry for the noise if it’s not relevant.
Thanks. My original issue described from this ticket remains. No solution yet.
@ryan-cubic how would this not be related when the error “no such execution context” is the same?
EDIT: All issues I have seen so far that throw this error seem to relate to an issue with chromedriver.
It might not be directly related to the exact issue I shared but the error seems to be related to something going wrong in chromedriver.
Since we cannot reproduce the issue like Christian said we can only provide information like this and make guesses instead of actually offer anything concrete.
I’m going to close the issue for now, feel free to reach out with a reproducible example. I personally would start by comparing what makes this button different from others, does it redirect while others do not? Does it have different html attributes? Etc
Based on the logs:
It seems like that you are fetching an element, clicking on it fails due to stale element exception and then the retry fails as well as the selector is not passed forward correctly. Is there any chance you can create a reproducible example?
Oh, today I got the same behaviour on 118 chrome. It actually clicks the button but gets the wrong response from chromedriver and tries to click it again but button is not there anymore. So before clicking:
Clicking with ERROR:
And then RETRIES after click actually happend and button is not available anymore:
It happens for me on chrome browserVersion: ‘118’ webdriverio: ‘8.15.4’
Hi @ryan-cubic is this part
The selector "" used with strategy "css selector" is invalid!a direct copy of the actual error? Because it seems really strange that the selector is empty. And If so, is#saveqatestthe actually selector with which this happens? As I have never seen issues like this with the id selector or any other selector for that matter.