共 10 篇文章 |
|
切换窗口public boolean testNewWindow(){ String currentHandle = driver.getWindowHandle(); Set handles = driver.getWindowHandles(); handles.remove(currentHandle); if (handles.size() >0) { try{ driver.switchTo().window(handles.iterator().next()); return true; }catch(Exception e){ System.out.println(e.getMessage());Sys... 阅48 转0 评0 公众公开 13-08-23 11:17 |
# css属性定位soso首页搜索框s_input = dr.find_element(:css => ''#s_input'')使用xpath定位。soso首页的搜索输入框的html代码如下:<input type="text" name="w"smartpid="sb.idx"smartch="sb.c.idx"autocomplete="off"id="s_input"value=""&g... 阅568 转0 评0 公众公开 13-08-21 18:05 |
webdriver 弹出窗口定位 java捕获或者说定位弹出窗口的关键在于获得弹出窗口的句柄。在代码里,使用getWindowHandle方法来获取当前浏览器窗口的句柄,使用了getWindowHandles方法获取所有弹出的浏览器窗口的句柄,然后通过排除当前句柄的方法来得到新开窗口的句柄。在获取新弹出窗口的句柄后,使用switchto.window(newwindow_handle)方法,将新... 阅2427 转15 评0 公众公开 13-08-19 15:31 |
Selenium WebDriver学习文档(二)文章转于:http://www.loggingselenium.com/2013/01/selenium-webdriver%E5%AD%A6%E4%B9%A0%E6%96%87%E6%A1%A3%EF%BC%88%E4%BA%8C%EF%BC%89.html.示例:HTML示例:另外,WebDriver在每一个元素上有一个方便的“submit方法。如果你调用处于表单内的元素的提交方法,会唤醒DOM找到from标签的结束符号并提交表单... 阅2268 转15 评0 公众公开 13-08-15 10:23 |
Selenium2.0之WebDriver学习总结(2)Selenium2.0之WebDriver学习总结(2)List<WebElement> cheeses = driver.findElements(By.className("cheese"));WebElement cheese = driver.findElement(By.name("cheese"));WebElement cheese = driver.findElement(By.linkText("cheese"));WebElement cheese = dr... 阅101 转自hh3755 公众公开 13-08-13 14:55 |
我们常用的浏览器有firefox和IE两种,firefox是selenium支持得比较成熟的浏览器。WebElement element = driver.findElement(By.id("passwd-id"));WebElement element =driver.findElement(By.xpath("//input[@id=''passwd-id'']"));driver = webdriver.Selenium2.0中使用WeDriver API对页面进行操作,它最... 阅37 转自闲来看看 公众公开 13-08-07 15:51 |
WebDriver入门1.1 下载selenium2.0的lib包。WebElement element = driver.findElement(By.id("passwd-id"));Selenium2.0中使用WeDriver API对页面进行操作,它最大的优点是不需要安装一个selenium server就可以运行,但是对页面进行操作不如selenium1.0的Selenium RC API那么方便。Selenium2.0提供了使用Selenium RC API的方法:Sele... 阅20 转自迷失咖啡屋 公众公开 13-08-05 14:12 |