首页 > 其他 > 详细

使用Firefox Driver 示例

时间:2015-05-29 17:48:36      阅读:142      评论:0      收藏:0      [点我收藏+]

//导入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();

  }

}

使用Firefox Driver 示例

原文:http://www.cnblogs.com/feifeidxl/p/4538591.html

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