首页 > 其他 > 详细

[Selenium]刷新页面 Refresh page

时间:2014-11-14 17:19:18      阅读:739      评论:0      收藏:0      [点我收藏+]

5 different ways to refresh a webpage using Selenium Webdriver

 
Here are the 5 different ways, using which we can refresh a webpage.There might be even more :)

There is no special extra coding. I have just used the existing functions in different ways to get it work. Here they are :

1.Using sendKeys.Keys method

    driver.get("https://accounts.google.com/SignUp");  
    driver.findElement(By.id("firstname-placeholder")).sendKeys(Keys.F5);  

 2.Using navigate.refresh()  method

    driver.get("https://accounts.google.com/SignUp");    
    driver.navigate().refresh();  

 3.Using navigate.to() method

    driver.get("https://accounts.google.com/SignUp");    
    driver.navigate().to(driver.getCurrentUrl());  

 4.Using get() method

    driver.get("https://accounts.google.com/SignUp");    
    driver.get(driver.getCurrentUrl());  

 5.Using sendKeys() method

    driver.get("https://accounts.google.com/SignUp");   
    driver.findElement(By.id("firstname-placeholder")).sendKeys("\uE035");  

 

[Selenium]刷新页面 Refresh page

原文:http://www.cnblogs.com/MasterMonkInTemple/p/4097512.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!