码迷,mamicode.com
首页 > 其他好文 > 详细

使用Firefox Driver 示例

时间:2015-05-29 17:49:42      阅读:115      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!