如何验证某个部分的复选框,最多10个,连续2个,并选中该复选框?
要验证复选框已选中
Boolean isCheckboxChecked =
driver.findElement(By.xpath("//*[contains(@class, 'checkboxSection')]//input[@type='checkbox']")).isSelected();
验证该部分的最大复选框为10
Boolean isCheckboxMaxTen =
driver.findElements(By.xpath("//*[contains(@class, 'checkboxSection')]//input[@type='checkbox']")).size() <= 10;
验证连续最多2个复选框
知道如何验证max 2 checkbox in a row
if ((isCheckboxChecked == true) && (isCheckboxMaxTen == true) && (isCheckboxTwoInARow == true)){
// Pass
}
else
{
// Fail
}
添加了html代码
<form name="formApp" method="post" action="/apps/GeneralManager">
<div class="USK_A">
<img class="BOL_B" alt="" src="http://apps.com"/>
<div class="MOV_HOL_A">
<p class="bold">
<ul class="form_movie">
<li>
<input type="checkbox" checked="checked" value="3000000190795" name="point_id"/>
Movie_A
</li>
</ul>
<p class="mv5">
</div>
</div>
</form>