访问某网页地址

  被测网址http:http://www.baidu.com

  Java语言版本的API实例代码

  方法一:

  @Test

  public void visitURL(){

    String baseUrl = "http://www.baidu.com";

    driver.get(baseUrl);

  }

  方法二:

  @Test

  public void visitURL(){

    String baseUrl = "http://www.baidu.com";

    driver.navigate().to(baseUrl);

  }

  返回上一个访问的网页

  被测网址http:http://www.baidu.com

  被测网址http:http://www.sogou.com

  Java语言版本的API实例代码

  @Test
  public void visitRecentURL() {
    driver.navigate().to(url1);
    driver.navigate().to(url2);
    driver.navigate().back(); //返回上一次访问的页面
}

  从上次访问网页前进到下一个网页

  被测网址http:http://www.baidu.com

  被测网址http:http://www.sogou.com

  Java语言版本的API实例代码

  String url1 = "http://www.baidu.com";
  String url2 = "http://www.sogou.com";
  @Test
  public void visitRecentURL() {
    driver.manage().window().maximize();
    driver.navigate().to(url1);
    driver.navigate().to(url2);
    driver.navigate().back(); //返回上一次访问的页面
    driver.navigate().forward();//从百度跳转到搜狗
}

  刷新当前网页

  被测网址http:http://www.baidu.com

  Java语言版本的API实例代码

  String url="http://www.baidu.com";

  @Test
  public void freshCurrentPage() {
    driver.manage().window().maximize();
    driver.navigate().to(url);
    driver.navigate().refresh();
}

WebDriverAPI(1)的更多相关文章

  1. WebDriverAPI(7)

      查看页面元素的属性 测试网址 http://www.baidu.com Java语言版本API实例 @Test public void getWebElementAttribute() { dri ...

  2. WebDriverAPI(10)

    操作Frame页面元素 测试网址代码 frameset.html: <html> <head> <title>frameset页面</title> &l ...

  3. WebDriverAPI(9)

    操作JavaScript的Alert窗口 测试网址代码 <html> <head> <title>你喜欢的水果</title> </head> ...

  4. WebDriverAPI(4)

    单击某个元素 采用元素id.click()方法即可 双击某个元素id.doubleClick 操作单选下拉列表 测试网页HTML代码 <html> <body> <sel ...

  5. WebDriverAPI(2)

    操作浏览器窗口 被测网址http:http://www.baidu.com Java语言版本的API实例代码 String url = "http://www.baidu.com" ...

  6. WebDriverAPI(8)

    判断页面元素是否存在 测试网址 http://www.baidu.com Java语言版本API实例 @Test public void testIsElementPresent(){ driver. ...

  7. WebDriverAPI(6)

    在指定元素上方进行鼠标悬浮 测试网址 http://www.baidu.com Java语言版本实例 @Test public void roverOnElement() { driver.manag ...

  8. WebDriverAPI(5)

    将当前浏览器截屏 测试网址 http://www.baidu.com Java语言版本实例 @Test public void captureScreenInCurrentWindows() { dr ...

  9. WebDriverAPI(3)

    获取页面的Title属性 被测网址http:http://www.baidu.com Java语言版本的API实例代码 String url = "http://www.baidu.com& ...

随机推荐

  1. 如何使用css来让图片居中不变形 微信小程序和web端适用

    图片变形很多人祭奠出了妖魔鬼怪般的各种大法,比如使用jq来写,或者使用css表达式来写.今天我总结的是使用css3来写,唯一最大缺点就是对一些浏览器版本不够兼容.下面就是关于如何使用css来让图片居中 ...

  2. 程序员面试50题(1)—查找最小的k个元素[算法]

    题目:输入n个整数,输出其中最小的k个.例如输入1,2,3,4,5,6,7和8这8个数字,则最小的4个数字为1,2,3和4. 分析:这道题最简单的思路莫过于把输入的n个整数排序,这样排在最前面的k个数 ...

  3. js函数预编译

    function fn(a){ console.log(a); var a = 123; function a(){} console.log(a); var b = function(){} con ...

  4. autolayout之后获取uiview的frame

    这个只要一行代码就搞定了.详细请看: In order to get the right frame/bounds of your UIImageView after resizing, you ne ...

  5. 【翻译】JavaScript循环和作用域

    我的翻译小站:https://www.zcfy.cc/article/javascript-loops-and-scope 翻译原文链接:https://flaviocopes.com/javascr ...

  6. python socket.error: [Errno 10061]

    用Python写server和client时候如果server中sock.bind(('localhost', 8001))  则client中sock.connect(('localhost', 8 ...

  7. 类之间关系理解:组合>聚合>关联>依赖;实现,继承

    类之间关系理解:组合>聚合>关联>依赖:实现,继承 1. 从类之间的关系来看,不外乎以下几种 组合>聚合>关联>依赖:实现,继承 且可以分为以下两类: (1)实现, ...

  8. ACL登陆认证

    前篇文章ACL授权实例介绍了授权,授权完成之后,就要进行认证.ACL的认证主要分为登陆认证与即时认证.所谓登录认证就是在用户登陆的时候,进行信息认证.根据用户Id,加载上来该用户所拥有的权限模块:而即 ...

  9. spring mvc + velocity 搭建实例程序maven版本并且使用的是tomcat容器而不是jetty(step by step)

    笔者最近在学习spring mvc 查了很多资料,但用jsp的居多,但项目中需要用velocity,所以说就学习了一下,现将所查资料以及搭建过程陈述如下,供需要的人参考 1.楼主用的是eclipse+ ...

  10. What if you are involved in an automobile accident in the US

    What if you are involved in an automobile accident in the US With increasing Chinese tourists and vi ...