我最近正在温习我在TOSCA中的技能,我在2年前就开始研究它,并切换到Selenium,我注意到新的TOSCA允许使用Xpath进行识别,我现在真的很熟悉它,但是,我不能让它在TOSCA中工作,我确信对象识别可以工作,因为我正在google chrome开发工具中测试我的xpath。
像(//*text()=‘忘记密码?’)1这样简单的东西似乎不起作用。我是不是漏掉了什么?
这是我在本例中用作参考的网页:https://www.freecrm.com/index.html
发布于 2020-05-29 12:02:45
XPath当然可以用来在Tosca中识别HTML的元素。
由于这个问题最初是发布的,所以“忘记密码?”https://www.freecrm.com/index.html上的链接似乎已更改,因此其文本现在为“忘记密码?”实际上位于https://ui.freecrm.com/。为了说明这一变化,这个答案使用了“(//*text()=‘忘记密码?’)1”,而不是原始帖子中提供的表达式。
通过文本修改,表达式在用双引号将元素括起来后,可以在XScan中标识该元素:
"(//*[text()='Forgot your password?'])[1]"在Tosca中使用XPath时,请记住以下几点:
"id('ui')/div[1]/div[1]/div[1]/a[1]"- An XPath expression is visible and editable in the XModuleAttribute properties without having to rescan. Personally, I find it easier to work with than the XML value of the RelativeId property that is generated when using Identify by Anchor.
- With Anchor, I've had issues where XModuleAttributes scanned in one browser can no longer be found when switching to another browser, specifically from IE to Chrome. With XPath, I've not had these issues.
发布于 2018-04-19 21:59:00
我所知道的是,在Tosca测试中处理XML消息时,您可以使用XPath来标识元素。您的用例似乎是UI测试,但我不确定这一点。
发布于 2018-04-20 14:38:37
您是否尝试过使用XScan来扫描页面?通常,Tosca会自动为您计算一个可以立即使用的XPath表达式。
如果它仍然不能工作,请尝试更具体?什么不起作用?错误消息?意外的行为?...
https://stackoverflow.com/questions/49900389
复制相似问题