javascript - 如何验证shadow dom中的文本颜色?
问题描述
控制台中的 dom我正在尝试验证 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'.
解决方案
推荐阅读
- function - Aurelia 绑定到带参数的函数并强制更新
- c# - 根据其他数据网格中的选择将项目添加到数据库/数据网格
- ios - 适用于 iOS 的 Google 登录:使用最新的 SDK v5.0.1 时无法设置自定义语言
- php - 如何将 GET 参数传递给 POST 表单
- git - 如何为 GitLab 组生成唯一的 ssh 密钥?
- r - Dockerfile 用于 R-base 上的最小图像大小
- python - KeyError:spyder 中的“kivy.garden.matplotlib”
- magento2 - Magento 2 如何删除内联翻译
- python - 如何在python中使用逻辑运算符
- python - 如何在 matplotlib 图中正确显示来自 csv 的日期?