How to refresh an already opened web page

前端 未结 6 1503
孤城傲影
孤城傲影 2021-01-01 14:12

I just want to refresh an already opened web page with Selenium.

It always opens a new browser window.

What I\'m doing wrong?

fr         


        
6条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-01 15:11

    You can try any one of the below methods for the same.

    Method 1:

    driver.findElement(By.name("s")).sendKeys(Keys.F5);
    

    Method 2:

    driver.get(driver.getCurrentUrl());
    

    Method3:

    driver.navigate().to(driver.getCurrentUrl());
    

    Method4:

    driver.findElement(By.name("s")).sendKeys("\uE035");
    

提交回复
热议问题