无法使用Android WebDriver切换到IFrame
我想知道是否有人能指出我到底做错了什么。我正在尝试使用Android WebDriver访问iframe。当我单击主页上的登录链接时,iframe将打开。下面是一段src代码,其中包含我试图访问的iframe id-无法使用Android WebDriver切换到IFrame,android,webdriver,Android,Webdriver,我想知道是否有人能指出我到底做错了什么。我正在尝试使用Android WebDriver访问iframe。当我单击主页上的登录链接时,iframe将打开。下面是一段src代码,其中包含我试图访问的iframe id- <div class="dialog" style="background-color: rgb(232, 235, 238); color: rgb(51, 51, 51);"> <iframe id="registration-dialog-frame"
<div class="dialog" style="background-color: rgb(232, 235, 238); color: rgb(51, 51, 51);">
<iframe id="registration-dialog-frame" scrolling="no" frameborder="0" src="http://test.com" border="0" allowtransparency="true" style="width: 235px;">
<html>
</iframe>
<span id="signin-cancel" class="cancelButton">Cancel</span>
我得到一份工作
org.openqa.selenium.WebDriverException: Error: {"message":"Cannot read property 'document' of undefined"}
org.openqa.selenium.WebDriverException: java.util.ArrayList cannot be cast to org.openqa.selenium.android.library.DomWindow
当我尝试这个的时候
driver.switchTo().frame(driver.findElement(By.id("registration-dialog-frame")));
我得到一份工作
org.openqa.selenium.WebDriverException: Error: {"message":"Cannot read property 'document' of undefined"}
org.openqa.selenium.WebDriverException: java.util.ArrayList cannot be cast to org.openqa.selenium.android.library.DomWindow
这是安卓网络驱动程序吗?其他人在切换到iframe时是否遇到过类似的错误?有人知道我如何做到这一点吗?通过查看代码检查该页面中的帧数,并使用索引切换到该特定帧,如下所示
driver.switchTo().frame(frameindex);
例如:要切换到第一帧,请使用下线
driver.switchTo().frame(0);