我有这段文字,只需要验证每一行中的粗体字:
Insured Direct Bill/16.67%: $xxx.xx down,包括保单费和财务责任费,以及 5 期 $xxx.xx(不包括 $x.xx 分期付款)
Insured Direct Bill/25%:首付 $xxx.xx,包括保单费和财务责任费,以及 $xxx.xx 的 5 期分期付款(不包括 $x.xx 分期付款费)
电子资金转账:$xxx.xx首付,包括保单费和财务责任费,分5期$xxx.xx(不包括$x.xx分期费)
我假设我需要使用:
foo = 正则表达式
@browser.text.include?(foo)
我不知道如何让它看到货币金额以外的所有内容。 [^$\d+.\d+] 不包括所有货币,但包括 5 和 16.67
谢谢
最佳答案
regex = /Insured Direct Bill \/ 25%: \$(\d+\.\d+) down, includes the Policy Fee and Financial Responsibility Fee, and 5 installments of \$(\d+\.\d+) \(does not include \$(\d+\.\d+) installment fee\)/
@browser.text.match(regex)
关于ruby - 如何在使用 ruby/watir 排除随机变量的同时验证网络文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6113973/