Sitelet https://github.com/appium/python-client/issues/597
Skip to content

I'm not able to perform an easy task #597

Description

@mastrolube

Hello, I just started using Appium under windows, with uiautomator2. I'm trying to do a little click on an element, nothing else:
els1 = driver.find_elements(By.ID, "com.instagram.android:id/tab_avatar") this is where it crashes
which is the same as els1 = driver.find_elements_by_id("com.instagram.android:id/tab_avatar") as suggested by Appium, but deprecated..

This is the full code:

from appium import webdriver
from selenium.webdriver.common.by import By

desired_caps = {
    "platformName": "Android",
    "automationName": "UiAutomator2",
    "deviceName": "emulator-5554",
    "appPackage": "com.instagram.android",
    "appActivity": "com.instagram.mainactivity.MainActivity",
    "noReset": True,
    "fullReset": False,
    "newCommandTimeout": 120
}
driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_caps)
els1 = driver.find_elements(By.ID, "com.instagram.android:id/tab_avatar")
els1[0].click()
driver.quit()

This is what I get:

Traceback (most recent call last):
File "c:\users\dedil\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\dedil\appdata\local\programs\python\python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "c:\Users\dedil.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\lib\python\debugpy_main
.py", line 45, in
cli.main()
File "c:\Users\dedil.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\dedil.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("main"))
File "c:\users\dedil\appdata\local\programs\python\python37\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "c:\users\dedil\appdata\local\programs\python\python37\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "c:\users\dedil\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\dedil\OneDrive\Documents\GitHub\bot\GramAddict\core\test.py", line 32, in
els1 = driver.find_elements(By.ID, "com.instagram.android:id/tab_avatar")
File "c:\Users\dedil\OneDrive\Documents\GitHub\bot.venv\lib\site-packages\appium\webdriver\webdriver.py", line 308, in find_elements
return self.execute(RemoteCommand.FIND_ELEMENTS, {'using': by, 'value': value})['value'] or []
File "c:\Users\dedil\OneDrive\Documents\GitHub\bot.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 371, in execute
response.get('value', None))
File "c:\Users\dedil\OneDrive\Documents\GitHub\bot.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 345, in _unwrap_value
return list(self._unwrap_value(item) for item in value)
File "c:\Users\dedil\OneDrive\Documents\GitHub\bot.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 345, in
return list(self._unwrap_value(item) for item in value)
File "c:\Users\dedil\OneDrive\Documents\GitHub\bot.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 339, in _unwrap_value
return self.create_web_element(value['element-6066-11e4-a52e-4f735466cecf'])
File "c:\Users\dedil\OneDrive\Documents\GitHub\bot.venv\lib\site-packages\appium\webdriver\webdriver.py", line 323, in create_web_element
return MobileWebElement(self, element_id, w3c)
TypeError: init() takes 3 positional arguments but 4 were given

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions