如何单击页面刷新时ID持续更改的日期选择器

问题描述 投票:0回答:1

在我的页面中,我有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都会发生此更改,因此代码将失败

java selenium selenium-webdriver datepicker
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.