登録ページの「利用規約を読み、同意しました」というテキストの横にチェック ボックスがあります。再生中に、クリックが発生していることがわかります。しかし、最後にチェックボックスはまだチェックされていません。どうしてですか。
これは私のHTMLコードです
<div class="checkbox_container">
<input name="newuserXYX.agree" value="true" tabindex="106" id="newuserXYX.agree" onclick="ABC.e.reg.checkuserNameAvailability();" type="checkbox">
<input id="__checkbox_newuserXYX.agree" name="__checkbox_newuserXYX.agree" value="true" type="hidden">
<label id="registration_Agree" for="newuserXYX.agree">I have read and agree to the Terms and Conditions</label>
</div>
私は自分のtestNgコードを次のように書きました
boolean checked=driver.findElement(By.xpath("//input[@name='newuserXYX.agree']")).isSelected();
if(checked==false)
driver.findElement(By.xpath("//input[@name='newuserXYX.agree']")).click();
私が試したさまざまなアプローチは
@FindBy(how=How.ID_OR_NAME,using="newuserXYX.agree")
@CacheLookup
private WebElement iagreeCB;
および @Test 内
iagreeCB.click();
これらすべてについて、同様の結果が得られています。
チェックボックスをクリックできないのはなぜですか?