現在、JavaのSelenium WebDriverでチェックボックスをオン(チェック)できません。私はすべてを試みた。 Xpath、CssSelector、ID、Linktext、部分LinkText ... WebDriverがクリックを発生させますが、チェックボックスはチェックされません。チェックボックスSelenium WebDriver、Javaを選択できません
私はSelenium IDEで記録して再生すると、問題なくチェックボックスをチェックします。しかし、私がjavaで同じコードとロケータを使用すると、チェックボックスはチェックされません。
私はチェックボックスとして処理しようとしましたが、クリックしてみましたが、ラベルをクリックしようとしました。しかし、私はそれを働かせることはできません、そして、それは私を失望させ始めています。ここで
が、私はそれにアクセスしたいページのチェックボックスのためのコードである:ここで
<div class="accept-terms">
<div class="row">
<input id="sso-bonus-card-terms" name="cgvAccepted" class="checkbox-custom" data-msg-ssoBonusCardTerms="Veuillez accepter les conditions générales de SSO et Carrefour Bonus Card" type="checkbox" value="true"/><label for="sso-bonus-card-terms">J'accepte les <a href='#'>conditions générales</a> de SSO et Carrefour Bonus Card<span class='obligated'>*</span></label><input type="hidden" name="_cgvAccepted" value="on"/>
は今それをアクセスもする私のコードです...(私は出回っ、私のプロジェクトで中心的webdriverをインスタンスを持っていますそのページ上の要素が出回っに定義して位置しています)
@FindBy(css = "#registrationForm > div.registration-form-wrapper > div.registration-box.bonus-points-payment > div > div > div > div.col-xs-10 > div > div.card-bonus-content.card-no > div.accept-terms > div > label:nth-child(2)")
private WebElement ssoBonusCardTerms;
public SubscriptionWizardPage acceptGeneralConditions(){
logger.info("Scroll down and accept the general conditions");
townCityInput.sendKeys(Keys.PAGE_DOWN);
focus.moveToElement(webDriver.findElement(By.xpath("//*[@id=\"registrationForm\"]/div[4]/div[6]/div/div"))).perform();
focus.moveToElement(webDriver.findElement(By.id("sso-bonus-card-terms"))).perform();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
focus.moveToElement(ssoBonusCardTerms).click().perform();
return new SubscriptionWizardPage();
}
を私は名前でそれを選択した場合:私は、このメッセージが表示されます...「要素が現在表示されていないので、と相互作用することはできません」それは目に見える... – dbodart