On Sunday, 30 September 2012 01:31:52 UTC+1, Hava Edelstein wrote:In the IDE, I use this line:fireEvent | [element] | blur"fireEvent" is no longer supported in Selenium 2. I know there's TypeKeys, but to my understanding, this doesn't simulate what happens if the user leaves the field by manually clicking in another
field with the mouse.If you're aiming to simulate what happens when a user leaves a field by manually clicking in another field with the mouse, that's exactly what you should do.Assuming the field with ID someField currently has focus:driver.findElement(By.id("someOtherField")).click()will fire all of the relevant events on someField, and then focus someOtherField.Alternatively, you could (again, assuming someField already has focus), do something like press the tab key:driver.switchTo().activeElement().sendKeys(Key.TAB)Manually firing events is a worse and more fiddly way to test than justdoing what a user would do :)
http://osdir.com/ml/selenium-users/2012-09/msg02088.html
分享到:
相关推荐
webdriver API中文版 webdriver API中文版 2 1.1 下载selenium2.0的lib包 2 1.2 用webdriver打开一个浏览器 2 1.3 打开测试页面 3 1.4 GettingStarted 3 第2章 Webdirver对浏览器的支持 5 2.1 HtmlUnit Driver...
本书是一本从入门到精通模式的Selenium WebDriver实战经验分享书籍。全书共分为四个部分:第1部分基础篇主要讲解自动化测试相关的基础理论、WebDriver 环境安装、单元测试工具的使用方法以及 WebDrvier的入门使用...
WebDriver实验版VB6版WebDriver实验,压缩包中有技术文档《WebDriver原理及实验》
webdriver-helper安装包,whl版本
Selenium-Webdriver系列教程 Selenium 1.x时代已经远去,它理应躺在历史的角落里,靠着壁炉烤着火,抽着旱烟,在袅袅的升起的青烟中回忆那曾经属于自己的美好时代。 不过事实却并非如此,现今原本早应退役的...
Selenium WebDriver Practical Guide will guide you through the various APIs of WebDriver which should be used in automation tests, followed by a discussion of the various WebDriver implementations ...
IE Webdriver Python
php-webdriver-bindings这个PHP库允许创建功能测试与PHP webdriver
webdriver安装包
VB6版WebDriver实验,压缩包中有技术文档《WebDriver原理及实验》《WebDriver命令编程手册(英文版、中文机翻版)》,代码演示的功能有:操作浏览器自动打开百度、搜索mp3,获得网页源码,获得网页标题,网页截图,...
ruby2.0.0+selenium-webdriver+watir-webdriver+rails离线备份,设置环境变量后可使用(未测试)
webdriver 数据驱动 webdriver 数据驱动webdriver 数据驱动webdriver 数据驱动webdriver 数据驱动webdriver 数据驱动
Selenium WebDriver详解及事例
调用webdriver打开网页
讲述了WebDriver-xpath和WebDriver-Css的学习摘要笔记,对于初学者还是很有用的,我也是转载的
WebDriver命令参考手册
selenium-webdriver-2.40.0.gem
chromeDriver.exe工具是Chrome的WebDriver,可以用于自动化测试,可以操作浏览器,同时selenium操作chrome浏览器需要有ChromeDriver驱动来协助,支持爬虫
webdriver 兼容新测试 源码
selenium webdriver2 环境搭建