When Doing Selenium tests, to locate the certain web elements, there are several methods.
Like By.id, By.className, By.tagName, By.name... But among them all, we use By.xPath and By.cssSelector to specify the elements with complex structure in the web page.
Now, while we are writing script to find and locate those web elements, we should be aware of the differences of these two "locating stratogy".
There are four reasons for using CSS Locators:
1. They’re faster
2. They’re more readable
3. CSS is jQuery’s locating strategy
4. No one else uses XPATH anyways!
the speed of XPath vs the speed of CSS Locators can be viewed in performance metric script .
There wasn’t much of a difference in Firefox, Safari, or Chrome, but with IE, the results were undeniable. Take a look:
there is a tool called cssify It does the handy work of translating your XPaths to CSS automatically.
Is there any case when you shouldn’t use CSS Locators (yes, there are a few cases where it is not the right tool for the job).
You should see this
The above picture shows many selector Usage are not supported before IE9 version and firefox 4 version. When writing cssSelectors we should take these into account.
- 大小: 65.5 KB
- 大小: 44.4 KB
分享到:
相关推荐
赠送jar包:osgi-resource-locator-1.0.1.jar; 赠送原API文档:osgi-resource-locator-1.0.1-javadoc.jar; 赠送源代码:osgi-resource-locator-1.0.1-sources.jar; 赠送Maven依赖信息文件:osgi-resource-locator...
安装labview之后,如何解决NI service locator is not running
赠送jar包:hk2-locator-2.4.0-b34.jar; 赠送原API文档:hk2-locator-2.4.0-b34-javadoc.jar; 赠送源代码:hk2-locator-2.4.0-b34-sources.jar; 赠送Maven依赖信息文件:hk2-locator-2.4.0-b34.pom; 包含翻译后...
Laravel开发-locator 一个简单的本地路由器。
selenium xpath webdriver_element locator webdriver_element_locator-1.rev312-fx.xpi work with firefox version 19-37
oracle.jdbc-driver-locator.jar
selenium自动化测试,对象识别神器。Firefox插件element-locator-for-webdriv;(FirefoxSetup35.0.1chs.exe适用)
Autofac的ServiceLocator模式应用,零配置
WebJarAssetLocator locator = new WebJarAssetLocator(); String fullPathToRequirejs = locator.getFullPath("require.js"); 获取基本文件夹中的所有资产 WebJarAssetLocator locator = new WebJarAssetLocator...
这是一个互联网根据IP和域名定位的源代码,可以根据IP地址和制定域名获取相关的信息,如所属国家、地区、时区、互联网服务提供商(Isp)、经纬度等。同时利用Google地图自动显示该IP所处的地理位置。...
Firefox浏览器xpath插件webdriver_element_locator-1.rev312-fx.xpi
wifi破解 专用软件
赠送jar包:osgi-resource-locator-1.0.1.jar; 赠送原API文档:osgi-resource-locator-1.0.1-javadoc.jar; 赠送源代码:osgi-resource-locator-1.0.1-sources.jar; 赠送Maven依赖信息文件:osgi-resource-locator...
统一资源定位符(URL,英语Uniform Resource Locator的缩写)也被称为网页地址,是因特网上标准的资源的地址。它最初是由蒂姆•伯纳斯-李发明用来作为万维网的地址的。现在它已经被万维网联盟编制为因特网标准RFC...
赠送jar包:hk2-locator-2.4.0-b34.jar; 赠送原API文档:hk2-locator-2.4.0-b34-javadoc.jar; 赠送源代码:hk2-locator-2.4.0-b34-sources.jar; 赠送Maven依赖信息文件:hk2-locator-2.4.0-b34.pom; 包含翻译后...
检索IP所在地/查询域名归属是我们上网过程中经常打交道的一桩事,也许您已为此在收藏夹中准备了不少相关的查询网站、或是同时安装了多款 Whois 客户端等,而 Domain IP Locator 正是为提高您完成这些日常操作的效率...
Locatable是一个Swift微框架,它利用Property Wrappers通过自定义属性@Locatable实现Service Locator模式
Locator-micro 是定位器的微模板编译器。此组件可以与雅虎编译微定位器组件集成模板。在默认情况下,它支持 YUI 格式,使用 YAF 模版。编译后的模版可通过模块加载程序用于服务器和客户端,切该模块加载程序取决于...