I am creating automated tests using Appium to test an android app

I am creating automated tests using Appium to test an android app. The issue that I am facing right now, is that I cannot select a checkbox, because the checkbox contains linked text.

I am using the following code to get checkbox element and click it -

WebElement termsAndConditionsCheckbox = (new WebDriverWait(driver, 60)).until(ExpectedConditions.presenceOfElementLocated(By.id(baseTest.getAndroidElementId("checkbox_terms_and_conditions"))));
termsAndConditionsCheckbox.click(); In app code, the checkbox's text is set as follows -mCheckboxTermsAndConditions.setText(Html.fromHtml(mSignUpAcceptTermsAndConditions));
mCheckboxTermsAndConditions.setMovementMethod(LinkMovementMethod.getInstance()); I do not see a custom click() in appium, which would allow me to check the checkbox.

Would appreciate any ideas / help.

Hi Tim,

You can use the find element By.className instead of By.id.

So for multiple such elements, you can have them referenced with index (in this case 0), for example:

WebElement submit = (WebElement) driver.findElements(By.className(RADIO_BUTTON)).get(0);
submit.click();