SeleniumHQ

1)Selenium Web driver

  • mvn 部署
    • copy pom.xml文件: http://seleniumhq.org/docs/03_webdriver.html#setting-up-a-selenium-webdriver-project
    • mvn clean install
    • mvn eclipse:eclipse
    • 导入到eclipse: http://seleniumhq.org/docs/appendix_installing_java_driver_Sel20_via_maven.html#importing-maven-into-eclipse-reference
    • 必要时安装m2e:http://www.sonatype.org/m2eclipse
  • 直接下载jar:
    • http://selenium.googlecode.com/files/selenium-java-2.25.0.zip (http://seleniumhq.org/download/)
2)Selenium Grid

  • 启动 hub:
    java -jar selenium-server-standalone-2.14.0.jar -role hub
  • 启动 node:
    java -jar selenium-server-standalone-2.14.0.jar -role hub
  • 使用 RemoteWebDriver:
  • // We could use any driver for our tests...
    DesiredCapabilities capabilities = new DesiredCapabilities();
    
    // ... but only if it supports javascript
    capabilities.setJavascriptEnabled(true);
    
    // Get a handle to the driver. This will throw an exception
    // if a matching driver cannot be located
    WebDriver driver = new RemoteWebDriver(capabilities);
    
    // Query the driver to find out more information
    Capabilities actualCapabilities = ((RemoteWebDriver) driver).getCapabilities();
    
    // And now use it
    driver.get("http://www.google.com");

  • 参考:http://code.google.com/p/selenium/wiki/RemoteWebDriver
  • HtmlUnit Driver
    最快,无UI的WebDriver,javascript引擎使用Rhino
    WebDriver driver = new HtmlUnitDriver();


3)Selenium IDE
  • 用export as 可以导出test case.
4)Python 接口
看例子中Python用法
driver = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.HTMLUNIT)
推测非java语言都要通过http接口呼叫selenium-server来执行用例。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值