附上图片了解更多详情请关注::![我要在文字区输入文字:图片中提到][1][1]:http: //i.stack.imgur.com/sai92.png I想将文本输入文本区域,但出现找不到元素的错误。我已经尝试过使用 X 路径、名称和 id,但无法执行此代码,并且想使用页面上出现的其他元素进行测试,但没有!!!我不知道它可以用 java-executor 或切换窗口(弹出)处理。下面提到的是 java 代码。如何处理这种情况,请提供详细信息。
Java代码:
@Test
public void CreteLead() throws InterruptedException
{
WebElement _loginName =
driver.findElement(By.xpath(OR.getProperty("username")));
_loginName.sendKeys(OR.getProperty("loginId"));
WebElement _password =
driver.findElement(By.xpath(OR.getProperty("password")));
_password.sendKeys(OR.getProperty("loginPassword"));
WebElement _login =
driver.findElement(By.xpath(OR.getProperty("login")));
_login.click();
Thread.sleep(5000);
WebElement _New =
driver.findElement(By.xpath(OR.getProperty("New")));
_New.click();
Thread.sleep(10000);
driver.findElement(By.id("btnCreateCustomer")).click();
HTML 代码:
<table class="tbl_top_align" width="100%" cellspacing="3" cellpadding="0">
<tbody>
<tr>
<tr>
<tr>
<tr id="trBranch">
<tr id="trAssign">
<td> Assign To*: </td>
<td>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="font-weight: normal !important;">
<div
id="ctl00_CPHPageContents_ctl00_CPHPageContents_ddlAssignedToPanel"
class="RadAjaxPanel" style="display: block;"
>
<span id="RequiredFieldValidator1"
class="error_message" style="display:none;"
>* missing</span>
</td>
<td style="vertical-align: middle !important;">
<td style="vertical-align: middle !important;"> Referral </td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding: 4px 0 5px;"> Follow-up on: </td>
<td style="padding: 4px 0 5px;">
<a id="btnFollowUp"
href="javascript:__doPostBack('ctl00$CPHPageContents$btnFollowUp','')"
>Not Scheduled</a>
</td>
</tr>
<tr>
<td> Account: </td>
<td>
<span id="ctl00_CPHPageContents_txtAccount_wrapper"
class="riSingle RadInput RadInput_Default" style="width: 160px;">
</td>
</tr>
<tr>
<td> Value: </td>
<td>
<span id="ctl00_CPHPageContents_txtAccountValue_wrapper"
class="riSingle RadInput RadInput_Default" style="width: 125px;">
</td>
</tr>
<tr>
<td>Description*:</td>
<td>
<textarea id="txtInstructions" class="schedule_notes"
style="height: 95px; width: 294px !important;" cols="20" rows="2"
name="ctl00$CPHPageContents$txtInstructions"
/>
<span id="RequiredFieldValidator2" class="error_message"
style="display:none;">* missing</span>
</td>
</tr>
<tr>
</tbody>
</table>
<div class="action_buttons">
</div>