Selenium Webdriver - using isDisplayed() in If statement is not working

前端 未结 3 920
无人及你
无人及你 2020-12-06 02:47

I am creating a script that involved searching for a record and then updating the record. On the search screen, the user has the option of viewing advanced search options.

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 03:32

    Use of Try Catch defies the very purpose of isdisplayed() used as If condition, one can write below code without using "if"

    try{
    driver.findElement(By.xpath(noRecordId)).isDisplayed();
    //Put then statements here
       }
    Catch(Exception e)
    {//put else statement here.}
    

提交回复
热议问题