我使用 selenium 和 java 开发了脚本,并面临无法在框架中输入值的问题。
请在这方面协助我。
HTML snippet:
<html>
<head>
<frameset>
<frame name ='test'...>
<html>
<head>
<body>
<form>
<div>
<iframe name ='test1'..>
<html>
<head>
<frameset name='MainContainer'..>
<frame name ='General' ..>
<div> .....</div>
<frame name ='GlobalOptions' ..>
<input name="scr" type="textbox" size="9" maxLength="8"/>
<frameset name='Container'..>
<frame name ='Gen' ..>
<div> .....</div>
<frame name ='Glo' ..>
<div> .....</div>
</div>
</form>
</body>
...
</html>
最佳答案
你的框架结构如此复杂。我认为使用JavascriptExecutor更好。试试这个代码:
((JavascriptExecutor) driver).executeScript("document.getElementsByName('scr').item(0).value = 'new text';");
关于java - Webdriver : Unable to enter value inside nested iframe, 框架集和框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37179072/