TestCafe :我有一个锚标记,其中有一个伪元素 ::before。如何选择仅当我将鼠标悬停在 ::before 元素上时出现在检查元素中的锚标记内的图像。这是锚标记:
<a class="nav-icon flag gh-desktop-only en-GB" role="button" data-toggle="collapse" aria-expanded="false" aria-controls="langDropdown" aria-label="Language Dropdown">::before</a>.
我已经尝试过这种方法,但它不起作用。它说元素在Dom中不可见:
const anchorTag = Selector('a.nav-icon.flag.gh-desktop-only.en-GB'); await t.click(anchorTag);
请指导我在这里缺少什么。
我尝试用您的示例重现该问题,但没有成功。请注意,Testcafe 操作不能针对pseudo-elements。 您可以使用 ClientFunction 作为解决方法