How to click on 'Print' button in chrome browser which will be in 'Shadow DOM'? | Selenium Forum
R
Raj Kishore Posted on 05/03/2020

Hi Ashish,

I want to access 'Print' button in Chrome Browser to print a webpage. I tried Actions, Robot classes but didn't resulted good.

The 'Print' button which i am trying to access is in a 'Shadow DOM', 'chrome://print/' which I do not have control on it. To get control on it we need to identify the 'Shadow Host' first.

How are we going to identify the 'Shadow Host'? Can you show me implementation on how to access 'Shadow Host' to access elements on 'Shadow Root' to click on 'Print' button.


I want to see your code how you are accessing 'Shadow Root' elements coming from 'Shadow Host' to click on the 'Print' button. Keep in mind that you will have to come from 'Shadow Host' to 'Shadow Root' that is the important.

Ex: Print the google search page in chrome browser.


Looking forward to see your code and this will really help other fellow coders to know more about Shadow DOM and its importance.


Regards,

Kishore