【发布时间】:2015-09-10 12:00:00
【问题描述】:
if(!driver.findElement(By.id("pt1:r1:0:r1:2:r1:0:it1::content")).isEnabled())
{
System.out.println("IS NOT DISPLAYED"); // if text box is display
driver.findElement(By.id("pt1:r1:0:r1:2:next")).click();
}
else if(driver.findElement(By.id("pt1:r1:0:r1:2:r1:0:it1::content")).isEnabled())
{
System.out.println("IS DISPLAYED"); // if text box is not display
driver.findElement(By.id("pt1:r1:0:r1:2:r1:0:it1::content")).sendkey("ABCXYZ");
driver.findElement(By.id("pt1:r1:0:r1:2:next")).click();
}
我已尝试使用 try 和 catch 阻止它的工作,但执行脚本需要时间。
【问题讨论】:
-
我不太明白你在寻求什么帮助。上面的代码有没有给你任何错误?您在哪里尝试插入 try/catch 并提供了任何信息或线索说明可能出现的问题?
-
他说上面的代码运行良好,但花费了太多时间。要求更好的解决方案或对代码进行一些修改以提高其性能
标签: java selenium selenium-webdriver