镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

module 'appium.webdriver' has no attribute 'Remote' #542

Closed

Description

@refaelsh

The problem

I have the same issue as this: #476.
His solution is not applicable to my case.

Here is the shortest possible code that reproduces the issue:

from appium import webdriver

driver = webdriver.Remote('http://localhost:4723/wd/hub', [])

The result is like this:

C:\Python36\python.exe C:/Users/rsheink/PycharmProjects/untitled/bla.py
Traceback (most recent call last):
  File "C:/Users/rsheink/PycharmProjects/untitled/bla.py", line 3, in <module>
    driver = webdriver.Remote('http://localhost:4723/wd/hub', [])
AttributeError: module 'appium.webdriver' has no attribute 'Remote'

Process finished with exit code 1

Please help :-)

Activity

  1. GlennJC commented on May 18, 2020

    @GlennJC

    @refaelsh Can you confirm what version of the Appium Python client you are using?

    Did a new install this morning and got v1.0.0. From what I can see so far, there is something broken in this release. Code that has been working for months completely stopped. There is no webdriver.Remote (same issue you are having), and the common namespace has completely disappeared (I stopped looking at that point). Went back to v0.52 and everything is working again.

    I'm using Python 3.8.2

  2. Aderlx commented on May 18, 2020

    @Aderlx

    what's wrong with v1.00?

  3. GlennJC commented on May 18, 2020

    @GlennJC

    what's wrong with v1.00?

    Its in my message, however consider the following code that passes validation under 0.52:

    from appium import webdriver
    from appium.webdriver.common.mobileby import MobileBy
    
    desired_caps = {"app": "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"}
    driver = webdriver.Remote(
        command_executor='http://127.0.0.1:4723',
        desired_capabilities=desired_caps)
    
    control = (MobileBy.ACCESSIBILITY_ID, 'MenuItemsHost')

    When run under 0.52, works fine. Under v1.0.0..

    C:\Testing>python appium_test.py
    Traceback (most recent call last):
      File "appium_test.py", line 2, in <module>
        from appium.webdriver.common.mobileby import MobileBy
    ModuleNotFoundError: No module named 'appium.webdriver.common'
    
    Traceback (most recent call last):
      File "appium_test.py", line 5, in <module>
        driver = webdriver.Remote(
    AttributeError: module 'appium.webdriver' has no attribute 'Remote'
    

    This is on a brand new (as in the machine is freshly built) installation of Python 3.8.2 and Appium 1.0.0

    Edit: Module was installed via

    pip install Appium-Python-Client
    

    Installation Text

    C:\Users\Install>pip install Appium-Python-Client
    Collecting Appium-Python-Client
      Using cached Appium-Python-Client-1.0.0.tar.gz (51 kB)
    Requirement already satisfied: selenium<4,>=3.14.1 in c:\program files (x86)\python38-32\lib\site-packages (from Appium-Python-Client) (3.141.0)
    Requirement already satisfied: urllib3 in c:\program files (x86)\python38-32\lib\site-packages (from selenium<4,>=3.14.1->Appium-Python-Client) (1.25.9)
    Building wheels for collected packages: Appium-Python-Client
      Building wheel for Appium-Python-Client (setup.py) ... done
      Created wheel for Appium-Python-Client: filename=Appium_Python_Client-1.0.0-py3-none-any.whl size=8809 sha256=c76d2445e21c5bc4e70f09ade1d1f131d318017508b203240c1f2aa36dbf6401
      Stored in directory: c:\users\install\appdata\local\pip\cache\wheels\9f\04\d8\8e500f1885940074c5f40f8be1ef17386789790999f252b238
    Successfully built Appium-Python-Client
    Installing collected packages: Appium-Python-Client
    Successfully installed Appium-Python-Client-1.0.0
    
  4. ki4070ma commented on May 18, 2020

    @ki4070ma
    Collaborator

    @GlennJC

    Could you try to run some functional tests in python-client?

    https://github.com/appium/python-client/tree/master/test/functional

    FYI

    I could run functional test as below with Appium-Python-Client 1.0.0.

    • macOS: 10.15.4
    • appium: 1.17.1-beta.0
    ➜  test git:(master) pip install Appium-Python-Client    
    Collecting Appium-Python-Client
      Using cached Appium-Python-Client-1.0.0.tar.gz (51 kB)
    Requirement already satisfied: selenium<4,>=3.14.1 in /Users/atsushimori/.pyenv/versions/3.8.1/lib/python3.8/site-packages (from Appium-Python-Client) (3.141.0)
    Requirement already satisfied: urllib3 in /Users/atsushimori/.pyenv/versions/3.8.1/lib/python3.8/site-packages (from selenium<4,>=3.14.1->Appium-Python-Client) (1.25.9)
    Building wheels for collected packages: Appium-Python-Client
      Building wheel for Appium-Python-Client (setup.py) ... done
      Created wheel for Appium-Python-Client: filename=Appium_Python_Client-1.0.0-py3-none-any.whl size=8803 sha256=35ea5b77bc25bccca8b03d5e2130323139b6a0d1091b404f48733be8f3f7c974
      Stored in directory: /Users/atsushimori/Library/Caches/pip/wheels/9f/04/d8/8e500f1885940074c5f40f8be1ef17386789790999f252b238
    Successfully built Appium-Python-Client
    Installing collected packages: Appium-Python-Client
    Successfully installed Appium-Python-Client-1.0.0
    ➜  test git:(master) pip show Appium-Python-Client
    Name: Appium-Python-Client
    Version: 1.0.0
    Summary: Python client for Appium
    Home-page: http://appium.io/
    Author: Isaac Murchie
    Author-email: isaac@saucelabs.com
    License: Apache 2.0
    Location: /Users/atsushimori/.pyenv/versions/3.8.1/lib/python3.8/site-packages
    Requires: selenium
    Required-by: 
    ➜  test git:(master) pwd                                   
    /Users/atsushimori/github/ki4070ma/python-client/test
    ➜  test git:(master) pytest functional/android/ime_tests.py
    .....                                                                                                                                           [100%]
    
    ---------- coverage: platform darwin, python 3.8.1-final-0 -----------
    Name                                                                                                                 Stmts   Miss  Cover
    ----------------------------------------------------------------------------------------------------------------------------------------
    /Users/atsushimori/github/ki4070ma/python-client/appium/__init__.py                                                      1      0   100%
    (--snip--)
    /Users/atsushimori/github/ki4070ma/python-client/appium/webdriver/webelement.py                                         45     27    40%
    ----------------------------------------------------------------------------------------------------------------------------------------
    TOTAL                                                                                                                 1678    913    46%
    
    5 passed in 39.68s
    
  5. mykola-mokhnach commented on May 18, 2020

    @mykola-mokhnach
    Contributor

    C:\Python36\python.exe

    @refaelsh Only Python 3.7+ is supported

    @GlennJC

    File "appium_test.py", line 2, in
    from appium.webdriver.common.mobileby import MobileBy
    ModuleNotFoundError: No module named 'appium.webdriver.common'

    Are you sure your PYTHONPATH is correct and there are no modules there or in the current dir, that might override the original python client imports?

  6. ZiuJyuGit commented on May 18, 2020

    @ZiuJyuGit

    uninstall v1.00 and install v0.52 is workable,thx @GlennJC

  7. refaelsh commented on May 18, 2020

    @refaelsh
    Author

    @refaelsh Can you confirm what version of the Appium Python client you are using?

    Version 1.0.0

  8. refaelsh commented on May 18, 2020

    @refaelsh
    Author

    C:\Python36\python.exe

    @refaelsh Only Python 3.7+ is supported

    I cant use Python 3.7. Its a corporate laptop, the only allowed Python version 3.6.x.

  9. GlennJC commented on May 18, 2020

    @GlennJC

    @GlennJC

    Could you try to run some functional tests in python-client?

    https://github.com/appium/python-client/tree/master/test/functional

    FYI

    I presume you require some sort of Android emulator running for those tests? I only use Appium for Windows-based application tests so don't have any iOS or Android emulators installed.

    C:\Test2>pip install Appium-Python-Client
    Requirement already satisfied: Appium-Python-Client in c:\program files (x86)\python38-32\lib\site-packages (1.0.0)
    Requirement already satisfied: selenium<4,>=3.14.1 in c:\program files (x86)\python38-32\lib\site-packages (from Appium-Python-Client) (3.141.0)
    Requirement already satisfied: urllib3 in c:\program files (x86)\python38-32\lib\site-packages (from selenium<4,>=3.14.1->Appium-Python-Client) (1.25.9)
    
    C:\Test2>pip show Appium-Python-Client
    Name: Appium-Python-Client
    Version: 1.0.0
    Summary: Python client for Appium
    Home-page: http://appium.io/
    Author: Isaac Murchie
    Author-email: isaac@saucelabs.com
    License: Apache 2.0
    Location: c:\program files (x86)\python38-32\lib\site-packages
    Requires: selenium
    Required-by:
    
  10. GlennJC commented on May 18, 2020

    @GlennJC

    Are you sure your PYTHONPATH is correct and there are no modules there or in the current dir, that might override the original python client imports?

    100% positive, how would I confirm this though?

    The machine is literally a fresh install of Windows 10, and then the following commands executed:

    python-3.8.2.exe /quiet InstallAllUsers=1 PrependPath=1
    python -m pip install --upgrade pip
    pip.exe install Appium-Python-Client
    pip.exe install numpy
    pip.exe install -U pylint
    pip.exe install pytest
    pip.exe install pytest-html
    pip.exe install pywin32
    pip.exe install wmi
    pip.exe install urllib3
    

    The test example I provided earlier was in a brand new empty directory with only that file located in it.

    Path is

    Path=C:\Program Files (x86)\Python38-32\Scripts\;C:\Program Files (x86)\Python38-32\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Install\AppData\Local\Microsoft\WindowsApps;
    

    there is no PYTHONPATH variable

    Not sure where else to look.

  11. PhilippSelenium commented on May 18, 2020

    @PhilippSelenium

    Having same issue using python 3.7
    from appium.webdriver import Remote
    Throws import error

  12. mykola-mokhnach commented on May 18, 2020

    @mykola-mokhnach
    Contributor

    I assume the import should look like from appium.webdriver.webdriver import WebDriver

  13. mykola-mokhnach commented on May 18, 2020

    @mykola-mokhnach
    Contributor

    The above import works because of

    from .webdriver import WebDriver as Remote

    declaration in

    python-client/appium/webdriver/__init__.py

    Make sure it's there. The path to the actual used module could be checked by printing the internal __file__ property of a module

  14. PhilippSelenium commented on May 18, 2020

    @PhilippSelenium

    Should the usage information in the README https://github.com/appium/python-client#usage be updated then?

  15. PhilippSelenium commented on May 18, 2020

    @PhilippSelenium

    from appium.webdriver.webdriver import WebDriver
    Doesn't work for me either.

  16. mykola-mokhnach commented on May 18, 2020

    @mykola-mokhnach
    Contributor

    @PhilippSelenium Have you checked the actual location of the modules according to what was mentioned above?

  17. mykola-mokhnach commented on May 18, 2020

    @mykola-mokhnach
    Contributor

    In general it is highly recommended to always wrap your project into a virtual environment. This helps to avoid the most of dependency issues (if not all). We use https://github.com/pypa/pipenv for the current client.

  18. PhilippSelenium commented on May 18, 2020

    @PhilippSelenium

    @mykola-mokhnach Yes, I'm of course working in a python 3.7 virtualenv where I only install Appium-Python-Client

    pip show
    
    Name: Appium-Python-Client
    Version: 1.0.0
    Summary: Python client for Appium
    Home-page: http://appium.io/
    Author: Isaac Murchie
    Author-email: isaac@saucelabs.com
    License: Apache 2.0
    Location: ~/.virtualenvs/test-python3.7/lib/python3.7/site-packages
    Requires: selenium
    Required-by: 
    
    $ ls ~/.virtualenvs/test-python3.7/lib/python3.7/site-packages/appium
    __init__.py  __pycache__  version.py  webdriver
    
    $ ls ~/.virtualenvs/test-python3.7/lib/python3.7/site-packages/appium/webdriver/
    py.typed
    
  19. mykola-mokhnach commented on May 18, 2020

    @mykola-mokhnach
    Contributor

    ^
    This looks bad. Very bad.
    It looks like package files were not uploaded to pip repository upon releasing.

    @KazuCocoa @ki4070ma Could you please verify the release was successful and reupload it as a patch if necessary?

  20. mykola-mokhnach commented on May 18, 2020

    @mykola-mokhnach
    Contributor
  21. KazuCocoa commented on May 18, 2020

    @KazuCocoa
    Member

    Okay. Will check it later, but https://pypi.org/project/Appium-Python-Client/1.0.0/#files looks good as a quick check.

  22. mykola-mokhnach commented on May 18, 2020

    @mykola-mokhnach
    Contributor

    This looks like a packaging issue. We'll republish the patched package soon

  23. ki4070ma commented on May 18, 2020

    @ki4070ma
    Collaborator

    As I commented as below, it worked.

    #542 (comment)

    And I've checked in my local environment, but it's same to below situation.

    #542 (comment)

    I'll check it for details.


    ^It's my wrong. In that case, codes under python-client/appium are used, not installed library.

  24. KazuCocoa commented on May 18, 2020

    @KazuCocoa
    Member

    Thanks for the report! 1.0.1 should fix this.
    py.typed for type hint is also in appium/webdrive

  25. chethank1990 commented on Sep 2, 2020

    @chethank1990

    Use this
    driver =webdriver.WebDriver( 'http://localhost:4723/wd/hub', desired_cap )

  26. vakennu commented on Mar 16, 2025

    @vakennu

    Sorry, but 5 years later I'm running into this issue.

    Use this driver =webdriver.WebDriver( 'http://localhost:4723/wd/hub', desired_cap )

    Was this the solution?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions