我想使用verifyElementPresent跳过我的Selenium测试脚本中的一大块代码。我在老的Firefox扩展中成功地使用了类似的东西,但我不知道如何让它在Chrome Kantu版本中工作。
我尝试过${!statusOK}==true和${!lastCommandOK}==true,我发现它们都很挑剔。我不能得到一个一致的测试用例,我也不确定为什么。我在FireFox浏览器扩展中使用了storeElementPresent,它一直都能正常工作,但该命令在Kantu中不可用。
下面的链接列出了我尝试使用verifyElementPresent的确切场景,但它对我不起作用。有没有人知道另一种方法?
https://a9t9.com/kantu/docs/selenium-ide/assertelementpresent-verifyelementpresent
{
"Command": "verifyElementPresent",
"Target": "//table[@id='phHeader']/tbody/tr/td[3]/div/div/div/span[2]",
"Value": ""
},
{
"Command": "gotoIf",
"Target": "${!statusOK} == true",
"Value": "logOut"
},
{
"Command": "gotoIf",
"Target": "${!statusOK} == false",
"Value": "logIn"
},我希望当元素出现时,它将转到代码的"logOut“标签。
请看我的Kantu播放器的图片,看看它到底哪里出了故障:https://imgur.com/ckzp1Aa
谢谢!
发布于 2020-10-20 05:35:50
我想做与所描述的问题相同的事情。我为Selenium IDE找到了一个解决方案,但它不使用verify element present命令。由于这个问题没有其他解决方案,我将发布一种我发现的帮助方法。
应该使用以下命令而不是verify element present命令:命令:store xpath count目标:<locator of object to find>,示例:xpath=\\a[id='logout']值:number
因此,检查元素是否存在的整个代码如下所示:
Command: store xpath count
Target: <locator of object to find>
Value: number
Command: if, Target: ${number} == 1
Command: click, Target: <locator>
... Any commands you want to execute
Command: end
Rest of code outside of if其中<locator>可以是xpath,css选择器。示例:在Firefox Selenium IDE的最新版本3.17.0上测试xpath=\\a[id='logout']。
发布于 2019-04-13 02:52:39
我能找到的唯一解决方案是在每次verify语句之前手动将!statusOK设置为true。它看起来像是在之前的失败中卡住了。这就解释了为什么它每次运行的表现都如此不同。我希望我的努力和最终的解释对其他人有帮助!我仍然在寻找如何让这些脚本更好地工作的技巧,所以如果你有什么好的技巧,请让我知道!
https://a9t9.com/kantu/docs#!statusOK
!statusOK (读/写)-包含宏执行的状态。一旦发生错误!statusOK就被设置为FALSE。使用时将!ErrorIgnore设置为true,以便在发生错误后继续执行宏。只有到那时,statusOK才会有用。否则,宏无论如何都会在错误处停止。!statusOK类似于!LastCommandOK,但它不会被成功的命令重置。一旦!statusOK被错误设置为"false",即使下一个命令成功,它也会保持"false“。但您可以使用store | true | !StatusOK手动重置它。
https://stackoverflow.com/questions/55657356
复制相似问题