无法点击注册页面中的复选框

时间:2016-03-16 18:02:58

标签: selenium testng

我正在为Autotrader.com注册页面编写selenium脚本。我无法点击“我同意”#39;复选框。这就是我写的:

WebElement cboxlink = driver.findElement(By.id("j_id_29-j_id_2h-"
        +                  "myatcRegisterForm-j_id_3n-acceptTerms"));

cboxlink.click();

HTML是:

<div id="j_id_3n" class="atcui atcui-form-row atcui-clearfix atcui-small terms" style="">
<input id="j_id_29-j_id_2h-myatcRegisterForm-j_id_3n-acceptTerms" class="checkbox" type="checkbox" value="true" name="j_id_29-j_id_2h-myatcRegisterForm-j_id_3n-acceptTerms">
<label for="j_id_29-j_id_2h-myatcRegisterForm-j_id_3n-acceptTerms">
I accept terms of the
<a target="_blank" href="/privacy.jsp">Privacy Statement</a> 
and <a target="_blank" href="/legal/visitor-agreement.xhtml">Visitor Agreement</a>.
</label>

0 个答案:

没有答案