如何在WebdriverIO + Appium中获取伪元素

问题描述 投票:0回答:1

我想在使用WDIO和Appium针对Android混合应用进行的测试中,从伪元素(content)的CSS中获取值(::before),因为设计者已存储了当前的响应设计状态那里。因此我的测试将知道预期的布局(元素)。

[对相关问题的多个答案(1; 2; 3)表示,使用.getComputedStyle()可能是唯一的解决方案。但这在我的测试中似乎不起作用。如果我使用window is not defined,则错误为window.getComputedStyle(...)的错误为document is not defineddocument.defaultView.getComputedStyle(...)。选择器本身也无法为其寻址伪元素seems

我多次尝试之一的示例:

document.defaultView.getComputedStyle($('body'),'::before').getPropertyValue('content')

问题:我需要以某种方式将windowdocument导入到我的测试中吗?还有其他方法可以从测试内部获取windowdocument吗?

最终:如何获得混合Android应用的content::before<body>值?

appium pseudo-element webdriver-io appium-android wdio-jasmine
1个回答
0
投票

感谢Jeremy Schneider(@YmerejRedienhcs)和Erwin Heitzman(@erwinheitzman)的帮助!

© www.soinside.com 2019 - 2024. All rights reserved.