ITeye博客

selenium

共 5 篇文章

selenium的WindowsUtils类

private static final int CPUTIME = 500; private static final int PERCENT = 100; private static final int FAULTLENGTH = 10; public static void main(String[] args) { WindowsUtils wu=new WindowsUtils(); System.out.println(wu.findReg()); System.out.println(wu.findTaskKill()); System.out.println(wu.find…

2013-04-02 14:41 · selenium

selenium中AddSelection的用法

此方法一般很少用。看了selenium的源码。下面首先看一下selenium的doSelect方法。也就是我们在选择下拉菜单用的select方法。可以通过index,label,value,id四种方式来select下拉菜单中的option。 doSelect源码如下: Selenium.prototype.doSelect = function(selectLocator, optionLocator) { /** * Select an option from a drop-down using an option locator. * * <p> * Option locators p…

2012-11-08 14:46 · selenium

在selenium中使用JQuery

执行以下步骤 1.把JQuery的js文件添加到selenium-server.jar的/core/scripts目录下. 2.修改selenium-server.jar/core/RemoteRunner.html,加入jquery js文件的引用. 3.调用selenium.addLocationStrategy方法添加一个selenium的查找策略,第一个参数是策略名称,第二个参数是查找所用到的js方法, inDocument是selenium的当前Document,locator是用户传进来的xpath,比如第四步中的#xxxx selenium.addLocationStrateg…

2012-11-08 14:45 · selenium

webdriver高级API----HamcrestWebDriverTestCase

一种为webdriver高级API api很像外语句子. 但是api的使用在项目中很有限制.起辅助作用.下面来看一下过程。 1.继承HamcrestWebDriverTestCase 2.选择一种Webdriver来实现createDriver() 方法。比如FirefoxDriver等 3.用类似goTo(),clickOn()等动作来浏览页面。 4.用assertPresenceOf(...)来判断页面 5.用Finder_s来区分页面中的元素 比如 link,button,textarea等 6.用Matcher_s来匹配具体的link,button,textarea等 package…

2012-11-08 14:32 · selenium

WebDriver——PageObject

package com.ahchoo.automation.page; importorg.openqa.selenium.By; importorg.openqa.selenium.WebDriver; importorg.openqa.selenium.WebElement; public class BaiduIndexPage { privateWebDriver driver; privatefinal String url = "http://www.baidu.com"; publicBaiduIndexPage(WebDriverdriver) { this.driver=d…

2012-09-26 11:55 · selenium