我正在为一个网站进行自动化测试,其中包含项目列表的下拉列表。我想从下拉列表中选择一个项目。以下代码选择我要选择的项目,但随后页面刷新,下拉框恢复为原始选项,并丢失以下代码选择的选项。
$driver->findElement(WebDriverBy::cssSelector('#_attend_status_0'))-> click();
echo "Mark roll status dropdown accessed... \n";
$driver->findElement(WebDriverBy::id('ATTEND_STATUS3'))->click();
echo " Absent Status Selected \n";
以下是html源代码
<select class="_attend_status_select" name="_attend_status_0" id="_attend_status_0" onchange="filterStatusChange(this.value, '_time_input_0', 908, 99 );
resetCheckbox(this.value, 0); " onkeyup="checkKeycode(event, 0, this.value, '_time_input_0', 908, 99, 7, '2'); " tabindex="6"><option id="ATTEND_STATUS1" value="1">None</option>
<option id="ATTEND_STATUS3" value="3">Absent</option>
<option id="ATTEND_STATUS4" value="4">Late</option>
<option id="ATTEND_STATUS5" value="5">Late Signed In</option>
<option id="ATTEND_STATUS18" value="18">Music</option>
<option id="ATTEND_STATUS19" value="19">Other Activity</option>
<option id="ATTEND_STATUS20" value="20">Pastoral Care</option>
<option id="ATTEND_STATUS2" value="2">Present</option></select>