selenium IDE:如何测试?或 * 作为文本的一部分,而不是作为通配符匹配?
请问如何验证带有特殊字符的文本?或 * 作为文本的一部分,而不是作为文本的通配符匹配?
我正在使用 selenium IDE 来验证浏览器弹出警报。弹出的警报消息包含一个特殊字符“这将更改地球仪设置,可以吗?”。当我使用目标为“这将更改地球设置,可以吗?”的VerifyConfirmation命令时,VerifyConfirmation命令将失败,错误消息为“[错误]活动值'这将更改地球设置,可以吗?” '不匹配“这将改变地球设置,可以吗?”似乎硒看到最后一个字符?作为通配符。我也尝试使用确切的:这将改变地球设置,可以吗?它也不起作用。
请问有没有办法测试最后一个字符为?,而不是通配符?
谢谢
Kam
May I ask how to verify a text with special character ? or * as part of the text, not as a wildcard match of the text?
I am using selenium IDE to verify a browser pop up alert. The pop up alert message contain a special character "This will change the globe setting, is it ok?". When I use the VerifyConfirmation command with target as "This will change the globe setting, is it ok?", the VerifyConfirmation command will fail and error message is "[error] Active value 'This will change the globe setting, is it ok?' did not match 'This will change the globe setting, is it ok?'. It seems like selenium see the last character ? as wildcard. I have also tried to use the exact:This will change the globe setting, is it ok? but it does not work too.
May I ask is there anyway to test the last character as ?, not a wildcard?
Thanks
Kam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为你的问题与问号有关。首先,?在 glob 模式中用于匹配任何单个字符,因此真正的问号将匹配特殊的问号。其次,我见过您经常看到的那种错误消息。它几乎总是与指定参数中的空格多于或少于页面中的空格有关。例如,“abcdef ghijklmn”与“abcdef ghijklmn”不匹配,但 IDE 的错误消息将显示两个字符串都带有一个空格。
的模式
尝试仅设置
以查看是否匹配。如果是,则开始一次添加一个单词,直到测试失败。
或者,只需查看源代码,以便将正确间隔的字符串复制/粘贴到 IDE 的“目标”字段中。
I don't think your problem is related to the question mark. First off, the ? in glob patterns is used to match any single character, so a real question mark would match the special question mark. Secondly, I've seen the sort of error message you're seeing quite often. It is almost always related to there being more or fewer white spaces in the argument specified than in the page. For example, "abcdef ghijklmn" doesn't match "abcdef ghijklmn" but IDE's error message will show both strings with a single space.
Try a pattern of just
setting
to see if it matches. If it does, then start adding one word at a time until the test fails.
OR, just look at the source so you can copy/paste the correctly spaced string into the Target field of IDE.