gpt4 book ai didi

java-正则表达式 : How to write regular expression for two digit numbers

转载 作者:行者123 更新时间:2023-12-01 07:20:14 25 4
gpt4 key购买 nike

我的密码字段带有 ID 定位器“j_idt90”。然而,ID 是动态的,并且每次加载登录页面时前面的两位数字都会发生变化。

我使用自动化来捕获此字段并在正则表达式下使用,但它失败了。请告诉我我在哪里未能识别该元素。

Reg Exp - driver.findElement(By.id("j_idt[0-9]{2}"));

最佳答案

您可以通过 XPath 来定位元素。假设您的页面中只有一个密码字段,则以下代码片段应该有效:

driver.findElement(By.xpath("//input[@type='password']"));

关于java-正则表达式 : How to write regular expression for two digit numbers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40883500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com