gpt4 book ai didi

javascript - 将 selenium 的 waitForCondition 与 xpath 一起使用

转载 作者:数据小太阳 更新时间:2023-10-29 04:59:43 24 4
gpt4 key购买 nike

Selenium 对通过 xpath 在页面中查找元素有一些很好的支持

selenium.isElementPresent("//textarea")

在 ajax 页面中,您可以使用 waitForCondition 在页面上等待,直到出现某些内容

selenium.waitForCondition("some_javascript_boolean_test_as_a_string", "5000")

我的困难是,我似乎无法使用 xpath 支持进行 bool 测试。 document.getElementById 似乎工作正常,但 selenium.isElementPresent 不行。

是否有任何简单的方法可以从 waitForCondition 的第一个参数中访问 selenium 的 xpath 元素查找功能?

最佳答案

更直接的方法是:

selenium.waitForCondition("selenium.isElementPresent(\"xpath=//*[@id='element_id_here']/ul\");", time_out_here);

关于javascript - 将 selenium 的 waitForCondition 与 xpath 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/999418/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com