当框架没有ID时如何在Selenium Webdriver中识别并切换到框架 [英] How to identify and switch to the frame in selenium webdriver when frame does not have id
本文介绍了当框架没有ID时如何在Selenium Webdriver中识别并切换到框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我如何识别并切换到只有标题的iframe?
Can anyone tell me how I can identify and switch to the iframe which has only a title?
<iframe frameborder="0" style="border: 0px none; width: 100%; height: 356px; min-width: 0px; min-height: 0px; overflow: auto;" dojoattachpoint="frame" title="Fill Quote" src="https://tssstrpms501.corp.trelleborg.com:12001/teamworks/process.lsw?zWorkflowState=1&zTaskId=4581&zResetContext=true&coachDebugTrace=none">
我已经尝试过下面的代码,但是它不起作用
I have tried by below code but it is not working
driver.switchTo().frame(driver.findElement(By.tagName("iframe")));
推荐答案
您可以使用cssSelector,
you can use cssSelector,
driver.switchTo().frame(driver.findElement(By.cssSelector("iframe[title='Fill Quote']")));
这篇关于当框架没有ID时如何在Selenium Webdriver中识别并切换到框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文