如何验证Shadow Dom中的文本颜色?

时间:2019-10-22 14:50:03

标签: javascript html selenium protractor shadow-dom

dom in console我正在尝试验证阴影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'.

0 个答案:

没有答案