0

Most of my application's elements are under shadow-root(open). I need to automate them using Protractor framework. deepCSS didnt work out. Please help me with automating these elements - mostly click.

I have to click on shadow-root elements using my protractor automation framework. I tried deepCSS, xpath etc. nothing worked.

    var spanElem = element.all(by.deepCss('.heading'));
    spanElem.click()
            //browser.actions().mouseMove(spanElem).click().perform();
Anup
  • 39
  • 6
  • First of all: what's the error you get? Second: Can you provide HTML source of the page. And last but not least: `spanElem` is `ElementArrayFinder` - you can not perform `click` method on it. See the reference (available only for `ElementFincer`): https://www.protractortest.org/#/api?view=webdriver.WebElement.prototype.click – Kacper Feb 03 '19 at 12:45

1 Answers1

0

Similar questions:

It seems Shadow DOM is not yet well supported by protractor. The Second question has an answer pointing to this issue https://github.com/angular/protractor/issues/4367 and a workaround for adding a custom locator by.addLocator('css_sr', (cssSelector: string, opt_parentElement, ..... I confirm this works in my case too.

acristu
  • 721
  • 6
  • 19