Appium Android click the checkbox

I'm using appium to create automated tests to test Android applications. The problem I'm facing now is that I can't select a check box because it contains linked text

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

WebElement termsAndConditionsCheck@R_921_2419@ = (new webdriverwait(driver, 60)).until(ExpectedConditions.presenceOfElementLocated(By.id(baseTest.getAndroidElementId("check@R_921_2419@_terms_and_conditions"))));
termsAndConditionsCheck@R_921_2419@.click();

In the application code, the text of the check box is set as follows:

mCheck@R_921_2419@TermsAndConditions.setText(Html.fromHtml(mSignUpAcceptTermsAndConditions));
mCheck@R_921_2419@TermsAndConditions.setMovementMethod(LinkMovementMethod.getInstance());

From the debugging options on the Android device, I turned on these options to view the pointer position of the click event, and I saw a click in the center of the check box (box text). Unfortunately, the point contains the linked text, so WebView starts instead of the "selected" check box

I don't see a custom click () in appium, which allows me to select the check box

Any ideas / help will be greatly appreciated

resolvent:

You can use the lookup element by. Classname instead of by. ID

Therefore, for multiple such elements, you can reference them with an index (0 in this case)

WebElement submit = (WebElement) driver.findElements(By.className(RA@R_419_2369@_BUTTON)).get(0);
submit.click();

I hope this will help

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>