在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_")]