- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
导出的代码:
public void testUntitledTestCase() throws Exception {
driver.get("URL");
driver.findElement(By.xpath("//button[@id='add-items']")).click();
driver.findElement(By.id("item_title")).sendKeys("Automation");
driver.findElement(By.id("item_cat_id")).click();
// ERROR: Caught exception [ERROR: Unsupported command [selectFrame | index=1 | ]]
driver.findElement(By.linkText("Cat1")).click();
// ERROR: Caught exception [ERROR: Unsupported command [selectFrame | relative=parent | ]]
driver.findElement(By.xpath("//button[@id='item-save']"").click();
}
错误发生在 Iframe 打开的位置。该应用程序有一个表单,其中某些字段具有按钮 - 单击这些按钮时会在弹出窗口(Iframe)中打开另一个 View 。我需要从 Iframe 中选择元素。它抛出一个错误:
// ERROR: Caught exception [ERROR: Unsupported command [selectFrame | index=1 | ]].
// ERROR: Caught exception [ERROR: Unsupported command [selectFrame | relative=parent | ]]
最佳答案
您确定它是 iFrame 吗?
如果是尝试获取 iFrame“名称”。将帮助您将注意力集中在正确的 Iframe/窗口/选项卡上。
希望这对你有帮助:)
List ele = driver.findElements(By.tagName("iframe")); System.out.println("Number of frames in a page :" + ele.size());
for(WebElement el : ele){ //返回帧的Id。
System.out.println("Frame Id :" + el.getAttribute("id"));
//Returns the Name of a frame.
System.out.println("Frame name :" + el.getAttribute("name"));
}
关于java - 错误: Caught exception [ERROR: Unsupported command [selectFrame | index=1 | ]] while exporting code from Selenium IDE to Webdriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51173105/
我尝试使用下面所示的 selenium 方法在 dojo 页面中选择一个框架,但失败了 driver.switchTo().frame(target); 我已将标题属性作为我的目标值。对于目标,我没有
两者有什么区别 Selenium.SelectFrame("relative=up"); Selenium.SelectFrame("relative=top"); Selenium.Selec
导出的代码: public void testUntitledTestCase() throws Exception { driver.get("URL"); driver.find
我是一名优秀的程序员,十分优秀!