Stack Exchange
How to validate text color in shadow dom?
dom in consoleI am trying to validate the text color of an element in shadow dom.
expect(browser.executeScript("return window.getComputedStyle(document.querySelector(\"body > moo-shell > auto-app\").shadowRoot.querySelector(\"section > auto-config\").shadowRoot.querySelector(\"section:nth-child(2) > div > div:nth-child(1) > section:nth-child(2) > div > vaadin-format-number-field\").shadowRoot.querySelector(\"#vaadin-format-number-field-label-1\"),':after').getPropertyValue('color')")).equals('rgb(204, 0, 0)');

F[09:37:59] E/launcher - javascript error: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.


I highly recommend to go through protractor documentation here https://www.protractortest.org/#/api, or taking a quick course on protractor

https://stackoverflow.com/questions/19916676/getting-the-value-of-a-pseudo-element-with-protractor where i have multiple shadow root..How to add multiple shadow root?
