在Selenium IDE中,我可以在类型命令中使用通配符吗?

编程入门 行业动态 更新时间:2024-10-10 17:22:38
本文介绍了在Selenium IDE中,我可以在类型命令中使用通配符吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是Selenium IDE的新手,这对我的测试非常有帮助,但我遇到了麻烦。我正在尝试在我公司的测试环境(电子商务公司)中输入虚假的信用卡号,但每次返回页面时XPath都会更改。路径如下。

I am new to Selenium IDE, which has been tremendously helpful in my testing, but I have run into a snag. I am trying to enter a fake credit card number in my company's testing environment (e-commerce company), but the XPath changes each time I go back to the page. The path is below.

//*[@id="dwfrm_paymentinstruments_creditcards_newcreditcard_number_d0hnrobkriuu"]

d0hnrobkriuu 每次都会改变。我尝试了以下替代方案 -

d0hnrobkriuu is what changes each time. I tried the following alternatives -

//*[@id="dwfrm_paymentinstruments_creditcards_newcreditcard_number_*"] //*[@id="dwfrm_paymentinstruments_creditcards_newcreditcard_number_[a-zA-Z0-9]"]

根据各种硒文件我发现,那些通配技术应该可行,但它们不是。任何帮助将不胜感激。

According to various selenium documentation I have found, those globbing techniques should work, but they're not. Any help would be greatly appreciated.

推荐答案

不是这样,不。但是,使用XPath contains() 功能,你可以做

Not this way, no. But, using the XPath contains() function, you can do

//*[contains(@id, "dwfrm_paymentinstruments_creditcards_newcreditcard_number_")]

更多推荐

在Selenium IDE中,我可以在类型命令中使用通配符吗?

本文发布于:2023-10-26 17:55:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1530906.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:通配符   命令   类型   Selenium   IDE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!