无需使用XPath或CssPath即可捕获WebElement的任何方法 [英] any way to catch a WebElement without using XPath or CssPath

查看:94
本文介绍了无需使用XPath或CssPath即可捕获WebElement的任何方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java和Selenium的新手,所以如果我的问题听起来有点主要,请事先道歉.

I am very new at Java and Selenium so my apologies in advance if my question sounds a bit primary.

我正在使用Selenium和Java编写测试.问题是我正在测试的应用程序尚未完成,其开发人员每天都会更改代码.当我使用XPath或CssPath时,它可能会在一段时间后发生变化,因此我必须遍历所有测试程序并更改那些XPathes或Css程序.

I am using Selenium and Java to write a test. The issue is the application I'm testing is not finished yet and its developers change the code daily. When I use XPath or CssPath it may change after a while, so I have to go through all my test program and change those XPathes or Css ones.

是否有其他方法可以在不使用Css或XPath的情况下访问WebElement?

Is there any other way that I can have access to a WebElement without using Css or XPath?

推荐答案

如果您不必使用Java,则可以考虑使用Robot Framework,它为您提供了以高级语言编写代码的可能性,该速度更快

If you do not have to use Java, you may consider using Robot Framework instead, it offers you the possibility to write code in high level language, which is faster.

使用Robot Framework,您可以使用Xpath,ID,名称,css选择器,标签,dom,jquery等来寻址元素.

With Robot Framework, you address an element using Xpath, ID, name, css selector, tag, dom, jquery and etc.

我认为开发人员不会那么频繁地更改标签,对吗?

I would think developers would not change tags so often, would they?

这篇关于无需使用XPath或CssPath即可捕获WebElement的任何方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆