相关疑难解决方法(0)

如何在 PLAYWRIGHT 上使用选择器进行条件语句?

我需要一些帮助来使用剧作家测试做出条件语句。
我有一个给定的选择器,比如说一个按钮,我需要编写如下的条件语句:

if (selector is not present/visible)

    do nothing and proceed with the *next lines of code*

else  

    await page.click(*selector*)

*next lines of code*
Run Code Online (Sandbox Code Playgroud)

有没有有效的方法来做这些事情?我在剧作家文档中没有找到任何内容。

javascript testing automated-tests typescript playwright

12
推荐指数
2
解决办法
2万
查看次数