Robot operations for shadow dom

I have been using Robot Operations for a shadow dom website testing. I am unable to scroll down the window. How can I scroll down using robot operations?

Also I am unable to insert special characters such as @,$ in the textbox. How can I insert @ in the email textbox for login testing?

Hi @mgg7934 ,

Please try to use Scroll To Element With Javascript action Instead

Regarding the second question, you can freeze the element of the text box and choose the action “type text” and in the inputs you can insert these special characters, should be no problem with that.

If you have further questions, please let me know and I’d be happy to help :slight_smile:

Hi @alex.ivanov

I can’t use the solution you gave me because just 1 element shows on my website, which ia generic web element. I am using Robot Operations for my website testing because JavaScript wasn’t successful which I have already tried.

@mgg7934

TestProject recorder doesn’t work on shadow dom pages, but there is a way around it.

The way to work on a shadow dom page is by using our Execute JavaScript method to perform the actions we want.

Here are the steps to follow to perform actions on the page:

  1. Create a step with the method Execute JavaScript

  1. Get into developer tools(F12 Botton)

to get to developer tools, you can click the F12 button or follow this:

  1. Click on the three dots at the top of your screen
  2. click on more tools
  3. click developer tools at the bottom

  1. find the js path of the element you want to perform an action this will act as your locator

  1. Now its time to build the script to be executed here is an example for three basic operations

  2. Click on an element: to do that, you will need to add this to the end of the path you copied .click();

In your scenario you can use:
.scrollIntoView({ block: "center", inline: "center", behavior: "smooth" });

  1. Type in element: to do that, you will need to add this to the end of the path you copied .value=“the text you want to put in.”

  1. Get text to parameter: to do that, you will need to add this to the start of the path you copied “return” and to the end “.textContent”

So as you can see using execute javascript is actually very easy,

you can see all the actions you can make on the element in this link :

Hi @alex.ivanov

As I mentioned earlier, Execute JavaScript won’t work on my shadow dom. Have a look at this:

@mgg7934

If you have opened the dev tools and do not have any elements, the issue is related to your application.
You have to check this scenario with your dev team and build elements that the dev tools can find.

Hi @alex.ivanov

I get that for the scroll.As for the @ symbol, why doesn’t this work on type text while some lowercase special characters work?

@mgg7934

Did you try to insert special characters without TestProject? Does it work properly?

This topic was automatically closed after 180 days. New replies are no longer allowed.