`
dyllove98
  • 浏览: 1384061 次
  • 性别: Icon_minigender_1
  • 来自: 济南
博客专栏
73a48ce3-d397-3b94-9f5d-49eb2ab017ab
Eclipse Rcp/R...
浏览量:38377
4322ac12-0ba9-3ac3-a3cf-b2f587fdfd3f
项目管理checkList...
浏览量:78736
4fb6ad91-52a6-307a-9e4f-816b4a7ce416
哲理故事与管理之道
浏览量:131906
社区版块
存档分类
最新评论

selenium htmlunitDriver 使用Demo

阅读更多

selenium2 提供了一种无ui模式的driver,即htmlunitdriver。特点运行比较快.其实htmlunitdriver 是对htmlunit 的封装,这样大家就可以使用自己习惯selenium2 语法来用它,下面来看一个简单的例子:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

public class TestHtmlUnit {
        static WebDriver driver =null;
        public  static void main(String[] args){
                
                driver=new HtmlUnitDriver();
                driver.get("http://www.baidu.com");
                driver.findElement(By.id("kw")).sendKeys("hello");
                driver.findElement(By.id("su")).click();
                
                System.out.println(driver.getTitle());
        }
}

0
2
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics