[Selenium] 使用Firefox Driver 示例
2015-05-29 15:22
218 查看
//导入Selenium 库和FirefoxDriver 库
package com.learningselenium.simplewebdriver;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class testFirefoxDriver(){
public static main(String[] args){
WebDriver driver = new FirefoxDriver(); //启用FirefoxDriver
driver.get("http://www.baidu.com"); //讲在Firefox 浏览器中打开百度主页
//讲获取当前页面的URL地址并存储在变量url 中。如果相同的操作需要在Selenium IDE 中完成,那么需要通过storeLocation 命令来完成
String url = driver.getCurrentUrl();
System.out.println(url);
driver.close();
}
}
package com.learningselenium.simplewebdriver;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class testFirefoxDriver(){
public static main(String[] args){
WebDriver driver = new FirefoxDriver(); //启用FirefoxDriver
driver.get("http://www.baidu.com"); //讲在Firefox 浏览器中打开百度主页
//讲获取当前页面的URL地址并存储在变量url 中。如果相同的操作需要在Selenium IDE 中完成,那么需要通过storeLocation 命令来完成
String url = driver.getCurrentUrl();
System.out.println(url);
driver.close();
}
}
相关文章推荐
- C#实现MD5加密
- 好用的ASP.NET 分页类 简单好用 支持 AJAX 自定义文字
- python的moudles文件中__all__作用
- http协议介绍及httpd特性详解
- jQuery on()方法
- mfc怎么把编辑框内的输入的数字存入int 2,如何把数字输出到编辑框内
- MyEclipse安装SVN插件
- Android点击Button实现功能的几种方法总结
- sql server中NULL导入decimal字段时报错
- 2015广东省赛总结
- md5加密导入库报错解决
- 在 docker 之间导出导入镜像
- 部署应用服务
- Android Studio集成Genymotion
- 第13周项目1动物这样叫(抽象类)
- java动态代理(JDK和cglib)
- cocos2dx CardinalSpline和CatmullRom算法
- elem.attr()无法正确判断checkbox是否选中
- Android Metrics
- hadoop中NameNode、DataNode、Secondary、NameNode、JobTracker TaskTracker介绍