gpt4 book ai didi

java - 如何点击页面刷新时 id 不断变化的日期选择器

转载 作者:行者123 更新时间:2023-12-01 17:06:34 26 4
gpt4 key购买 nike

在我的页面中,我有 2 个并排的日期选择器,并且两个日期选择器的类相同,只有 id 不同,并且这些 id 也会在页面刷新时保持更改

初始屏幕:

(日期选择器-1)

<input type="text" id="rp-datepicker-1" max="10" name="rp-datepicker-1" placeholder="Enter MM/DD/YYYY" class="rp-datepicker-field rp-datepicker-1 ng-untouched ng-pristine ng-invalid" xpath="1">

(日期选择器-2)

<input type="text" id="rp-datepicker-2" max="10" name="rp-datepicker-2" placeholder="Enter MM/DD/YYYY" class="rp-datepicker-field rp-datepicker-2 ng-untouched ng-pristine ng-valid" style="" xpath="1">

页面刷新页面后

(日期选择器-1)

<input type="text" id="rp-datepicker-5" max="10" name="rp-datepicker-5" placeholder="Enter MM/DD/YYYY" class="rp-datepicker-field rp-datepicker-5 ng-pristine ng-invalid ng-touched" xpath="1">

(日期选择器-2)

<input type="text" id="rp-datepicker-6" max="10" name="rp-datepicker-6" placeholder="Enter MM/DD/YYYY" class="rp-datepicker-field rp-datepicker-6 ng-untouched ng-pristine ng-valid" xpath="1">

由于每次 id 都发生变化,代码失败

最佳答案

x路径

//input[contains(@id, 'rp-datepicker-')]

CSS

input[id^='rp-datepicker']

关于java - 如何点击页面刷新时 id 不断变化的日期选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61460574/

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