Below is my Appium code to invoke the Settings
def invoke android(self)
caps = {
"platformName": "Android",
"platformVersion": "11.0",
"deviceName": "Pixel 5 Emulator",
"appPackage": "com.android.settings",
"appActivity": "com.android.settings.Settings"
}
driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", caps)
time.sleep(3)
links = driver.find_elements(AppiumBy.CLASS_NAME('android.widget.TextView'))
for link in links:
print(link.text)
if link.text == "Network & internet":
link.click()
time.sleep(4)
driver.quit()
**Getting error in below code:**
links = driver.find_elements(AppiumBy.CLASS_NAME('android.widget.TextView'))
E TypeError: 'str' object is not callable
From the docs found here, your usage of CLASS_NAME is wrong. CLASS_NAME is not a function. The usage you are after looks more like the following:
links = driver.find_elements(AppiumBy.CLASS_NAME, 'android.widget.TextView')