Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/91.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium Java代码无法捕获文本框_Java_Html_Selenium_Login_Business Intelligence - Fatal编程技术网

Selenium Java代码无法捕获文本框

Selenium Java代码无法捕获文本框,java,html,selenium,login,business-intelligence,Java,Html,Selenium,Login,Business Intelligence,我无法阅读此文本框以键入一些文本。该网页是Business Objects SAP工具的登录屏幕 这是HTML- <div class="logon_table" > <div id="userName" class="logon_input" > <label class="logon_input_label" tabindex="-1" for="usernameTextEdit" > ... </label> <input id="us

我无法阅读此文本框以键入一些文本。该网页是Business Objects SAP工具的登录屏幕

这是HTML-

<div class="logon_table" >
<div id="userName" class="logon_input" >
<label class="logon_input_label" tabindex="-1" for="usernameTextEdit" > ... </label>
<input id="usernameTextEdit" class="inputTextBox logonTextBox" type="text" value="****" name="username" ></input>
</div>
**Same for passwordTextEdit
</div>

您在此站点中有iframe。你必须先在那里转车

这应该起作用:

WebElement iframe = webDriver.findElement(By.id("infoView_home"));
webDriver.switchTo().frame(iframe);

webDriver.findElement(By.id("usernameTextEdit")).clear();
webDriver.findElement(By.id("usernameTextEdit")).sendKeys("SomeUserName");

webDriver.findElement(By.id("passwordTextEdit")).clear();
webDriver.findElement(By.id("passwordTextEdit")).sendKeys("Some Password");

您在此站点中有iframe。你必须先在那里转车

这应该起作用:

WebElement iframe = webDriver.findElement(By.id("infoView_home"));
webDriver.switchTo().frame(iframe);

webDriver.findElement(By.id("usernameTextEdit")).clear();
webDriver.findElement(By.id("usernameTextEdit")).sendKeys("SomeUserName");

webDriver.findElement(By.id("passwordTextEdit")).clear();
webDriver.findElement(By.id("passwordTextEdit")).sendKeys("Some Password");

对不起,我错了。是的,确实是个错误。我已经更正了代码。对于usernameTextEdit和passwordTextEdit,我都面临同样的问题。使用XPath语法或cssSelector提供的指导可能会有所帮助。很抱歉出现错误。是的,确实是个错误。我已经更正了代码。对于usernameTextEdit和passwordTextEdit,我都面临同样的问题。XPath语法或cssSelector的指导可能会有所帮助。会发生什么?你有什么例外吗?它适用于抛出的meException:org.openqa.selenium.NoSuchElementException:无法定位元素:{“方法”:“id”,“选择器”:“usernameTextEdit”}命令持续时间或超时:30.06秒使用此链接执行:
http://walery.bitbucket.org/org.walery.stackoverflow.q19002075/
这是我从你的问题中复制的测试端,确实在那里工作,我想知道我的BO登录页面有什么不好。可能是完整的页面层次结构。这是页面的完整层次结构-发生了什么?你有什么例外吗?它适用于抛出的meException:org.openqa.selenium.NoSuchElementException:无法定位元素:{“方法”:“id”,“选择器”:“usernameTextEdit”}命令持续时间或超时:30.06秒使用此链接执行:
http://walery.bitbucket.org/org.walery.stackoverflow.q19002075/
这是我从你的问题中复制的测试端,确实在那里工作,我想知道我的BO登录页面有什么不好。可能是完整的页面层次结构。这是页面的完整层次结构-