下面的代码使文本框为空白。一旦控件进入第二个文本框,第一个文本框将为空白。
{
WebDriverWait wait34 = new WebDriverWait(d, 30);
WebElement element34 = wait34.until(ExpectedConditions.elementToBeClickable(By.id("fisnInstrTypeDescriptionLabel")));
element34.sendKeys(e.getCellData("ISIN", 19, i));
WebDriverWait wait35 = new WebDriverWait(d, 30);
WebElement element35 = wait35.until(ExpectedConditions.elementToBeClickable(By.id("fisnRestrictionsLabel")));
element35.sendKeys(e.getCellData("ISIN", 20, i));
d.findElement(By.xpath("//input[@onclick='return submit_FISN();']")).click();
}
两个元素的HTML代码
<input type="text" name="fisnInstrTypeDescriptionLabel" size="70" value="" onblur="setFISNComponent('fisnInstrTypeDescription');" id="fisnInstrTypeDescriptionLabel" style="text-align: right" class="textField ui-autocomplete-input" autocomplete="off">
<input type="text" name="fisnRestrictionsLabel" size="70" value="" onblur="setFISNComponent('fisnRestrictions');" id="fisnRestrictionsLabel" style="text-align: right" class="textField ui-autocomplete-input" autocomplete="off">
答案 0 :(得分:0)
尝试:
{
WebDriverWait wait34 = new WebDriverWait(d, 30);
WebElement element34 = wait34.until(ExpectedConditions.elementToBeClickable(By.id("fisnInstrTypeDescriptionLabel")));
element34.clear();
element34.click();
element34.sendKeys(e.getCellData("ISIN", 19, i));
WebElement element35 = wait35.until(ExpectedConditions.elementToBeClickable(By.id("fisnRestrictionsLabel")));
element35.clear();
element35.click();
element35.sendKeys(e.getCellData("ISIN", 20, i));
d.findElement(By.xpath("//input[@onclick='return submit_FISN();']")).click();
}