我正在为Selenide的结帐页面编写自动化脚本。页面上有一个元素,表示条款和条件的复选框。我试图点击它但没有成功。但是,hover命令正常工作,没有任何错误。因此,单击时不可见,但悬停时可见。如何点击?
<input type="checkbox" name="order[accept_terms_and_conditions]"
id="order_accept_terms_and_conditions" value="1" aria-label="Accept
terms and conditions">
Th元素选择器:
private By termsCheckbox = By.xpath("//*[@id=\"bottom_form\"]/fieldset/ol/li/label/input");
采取行动的方法
public void clickTermsCheckbox(){
$(termsCheckbox).hover().click();
}
错误
Element should be visible {By.xpath: //*[@id="bottom_form"]/fieldset/ol/li/label/input}
尝试单击父元素:
$(termsCheckbox).parent().click()