我有一个简单的夜间测试。我需要单击 iframe 内的某个元素,但出现错误“预期“可见”,但得到:“未找到””。
.waitForElementVisible(".my_iframe", 30000) // this is work correctly
.pause(5000)
.frame('my_iframe') // I understood that it is needed to go inside iframe
.waitForElementVisible("card_input", 5000)
.frame(null)
元素card_input不可见。 如何使用 iframe 内的元素?
最佳答案
您的选择器“.my_iframe”表示一个类。您应该使用一些更独特的选择器,例如 id。您还可以使用 iframe 索引。 如果这是页面上第一个也是唯一一个 iframe,请尝试以下操作:
.waitForElementVisible("iframe", 30000) // long timeout, but whatever.
.pause(5000) // another long timeout.
.frame(0) // zero indexed: if 1st iframe on this page, 0 should work.
.waitForElementVisible("card_input", 5000)
.frame(null)
关于javascript - 夜间值类。无法点击 iframe 中的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42484831/