环境:selenium-2.53.0 + java + 火狐浏览器(45.0.1.5918) 测试网站:http://niu.xunlei.com/ 问题描述:元素是显示状态,也能定位到(在iframe中任意元素,如登陆的button),但是不能操作(click等) 代码如下: navigation.to("http://niu.xunlei.com/");
mainWindow.switchTo().frame("loginIframe");
List<WebElement> element = mainWindow.findElements(By.tagName("a"));
for(WebElement e:element){
System.out.println(e.getAttribute("id"));
}
System.out.println("button " + mainWindow.findElement(By.id("al_submit")).getRect());
System.out.println("button " + mainWindow.findElement(By.id("al_submit")).getSize());
System.out.println("button " + mainWindow.findElement(By.id("al_submit")).isDisplayed());
System.out.println("button " + mainWindow.findElement(By.id("al_submit")).isEnabled());
mainWindow.findElement(By.id("al_submit")).click(); -- 报异常org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Command duration or timeout 加打印信息如下: al_tab
ml_tab
al_submit
ml_gc
pl_gc
ml_submit
turnRegister
tl_arrow
mr_tab
ar_tab
pr_tab
mr_submit
ar_submit
pr_gc
pr_ccb
pr_submit
pr_finish
pr_pass
turnAccountLogin
turnMobileLogin
button org.openqa.selenium.Rectangle@0
button (0, 0)
button false
button true 有人碰到过类似的问题吗,应该怎样修改?(现在iframe中标签元素都能获取到信息,但是不能执行sendkeys、click等操作)?
|