I'm writing some code but I cant find the locator of checkbox please anyone help me to find locator! I've posted an image and sample code I've written below.
WebElement target = driver.findElement(By.id("term_and_conditions"));
target.click();
I'm writing some code but I cant find the locator of checkbox please anyone help me to find locator! I've posted an image and sample code I've written below.
WebElement target = driver.findElement(By.id("term_and_conditions"));
target.click();
To click the check box you can use either of the following Locator Strategies:
cssSelector:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='term_and_conditions']"))).click();
xpath:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//label[@for='term_and_conditions']"))).click();