Selenium WebDriver没有实现Selenium RC的isElementPresent()方法来检查页面上的元素是否存在。

在WebDriver中封装一个类似的方法,如下:

1 public boolean isElementPresent(WebDriver driver, By by){
2   try{
3     driver.findElement(by);
4     return ture;
5     }catch(Exception e){
6         return false;
7     }  
8 }

 

相关文章:

  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2021-06-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2021-05-21
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
相关资源
相似解决方案