Java 使用selenium时,Dojo页面中的selectFrame失败

Java 使用selenium时,Dojo页面中的selectFrame失败,java,selenium,selenium-webdriver,Java,Selenium,Selenium Webdriver,我尝试在dojo页面中使用selenium方法选择一个框架,但失败如下所示 driver.switchTo().frame(target); 我已将title属性作为目标值传递。 对于没有id或name属性的目标,如何传递下面元素的目标值 <iframe frameborder="0" title="Universal Line Template Configuration" style="width:100%;height:100%;" src="/ucmadmin/ccmadmin-

我尝试在dojo页面中使用selenium方法选择一个框架,但失败如下所示

driver.switchTo().frame(target);
我已将title属性作为目标值传递。 对于没有id或name属性的目标,如何传递下面元素的目标值

<iframe frameborder="0" title="Universal Line Template Configuration" style="width:100%;height:100%;" src="/ucmadmin/ccmadmin-latest?name=universalLineTemplate&key=a91ffd45-a34f-bc90-c159-1bef9e7c9921&permission=3">

除了行
driver.switchTo().frame(目标)之外,是否要执行任何操作

您需要首先找到帧。例如,通过xpath依赖于
title
标记:

WebElement frame = driver.findElement(By.xpath('//iframe[@title="Universal Line Template Configuration"]'));
将其用作目标:

driver.switchTo().frame(frame);
另见:

只需使用xpath或css而不是id来定位
driver.switchTo().frame(frame);