Selenium-IDE: How to verify/assert page refresh

后端 未结 4 1793
说谎
说谎 2021-01-15 10:00

I have a link on a page, which refreshes this page when clicked.

How can I verify with Selenium-IDE that the page has really been refreshed/reloaded?

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-15 10:23

    What you could assume is - if the element is found, and element.click() has been called, the element has been clicked.

    But for good practice - you should catch an exception if the element is not found in the DOM. I.E if it goes into catch block, then you know the page has not been refreshed.

    try{
        WebElement element = driver.findElement(selector); //The refresh link user clicks
        element.click();
        clicked = true;
    }catch(Exception e){
        clicked = false;
        throw new ElementNotFoundException();
    }
    

提交回复
热议问题