-
Notifications
You must be signed in to change notification settings - Fork 109
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
Shadow DOM testing with OpenTest #225
Comments
You can test the shadow DOM by executing client-side JavaScript. When you want to fail the test, you can throw a user-defined exception using the Suppose we have a simple HTML page like this:
If you wanted to add a test step in OpenTest to verify that the value of the input element in the shadow DOM is "John", you'd do it this way:
|
Ok thank you, and the selenium keywords will be used the same approach? |
If you're asking whether you can use the regular OpenTest Selenium keywords together with this approach, the answer is yes. You can combine any of the Selenium keywords with the code sample in the post above. The only thing to keep in mind though, is that the JavaScript code used with the |
Ok thank you for the explanation. |
Hi Adrian,
i justt copied the JS from the page:
so if i good understand you solution is like this:
This approach did not work. I used an extension in chrome to find the shadow path "LWC ShadowPath" and i used the following path just to see if it works:
I get the following in the log:
|
I'm afraid what you're looking for is not yet available in the Selenium library, but that's because the WebDriver standard doesn't support it yet. You can have a look at this issue. So you can validate elements in the shadow DOM using JavaScript code with the |
OK Thank you @adrianth , that's a pity as all the tests i have written in the last 8 months are not working because of this issue. I know it is not Opentest shortage of functionality but selenium. Do you have any expectation about that? |
While the proper way to solve this is for WebDriver to introduce support for the shadow DOM, you shouldn't give up the hope just yet, as it appears there might be some workarounds. I'll take a look at this again and will let you know if I have any good news. |
Thank you @adrianth , i do appreciate your support. |
Hi @adrianth do you have any update about this issue? |
Hi does any one tried this https://www.npmjs.com/package/wdio-webcomponents |
@wisam2013 I've done most of the research but there's no solution available yet. We need to make sure to implement this the right way so that we don't have to introduce breaking changes later on. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi, I did notice that on the selenium webdriver a support have been made to the shadow root. Can any one confirm that? When can we expect it to be used in Opentest. |
@wisam2013 I don't believe Selenium supports shadow DOM yet. If you have different information please provide a link an I will have a look. |
Hi @adrianth |
I have a question over testing Shadow DOM with opentest.
Is that possible?
The text was updated successfully, but these errors were encountered: