0

Elements which i need to click

Element loator

Hi I am trying to click checkbox. the below is my code

from appium import webdriver

import time from selenium.webdriver.common.action_chains import ActionChains

from selenium.webdriver.common.by import By

desired_cap = dict(

platformName="Android",
platformVersion="11",
deviceName="1234567",
appPackage="io.appium.android.apis",
appActivity="io.appium.android.apis.ApiDemos"

) driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_cap) driver.find_element(By.XPATH, "//android.widget.TextView[@text='Accessibility']").click() driver.find_element(By.XPATH, "//android.widget.TextView[@text='Accessibility Node Querying']").click() time.sleep(2) chk= driver.find_elements(By.XPATH, "//android.widget.CheckBox")

for i in chk: if i == 2: i.click()

By above code if i give i.click() i am able to click all checkboxes. But if i want to click single check box i am not getting solution.

1 Answers1

0

Select an array of elements and tap on its index

elements = self.driver.find_elements(*locator)
        elements[i].click()