Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove DeprecationWarning: desired_capabilities has been deprecated #680

Closed
jay0129 opened this issue Jan 26, 2022 · 5 comments
Closed

Comments

@jay0129
Copy link

jay0129 commented Jan 26, 2022

The problem

Code:
self.driver = webdriver.Remote(self.hub_url, self.caps, keep_alive=False)

Error:
/Users/user/.pyenv/versions/3.7.10/lib/python3.7/site-packages/appium/webdriver/webdriver.py:274: DeprecationWarning: desired_capabilities has been deprecated, please pass in an Options object with options kwarg

Environment

  • Appium: 1.22.2
  • Appium-Python-Client: 2.1.2
  • Host machine: OSX
@KazuCocoa
Copy link
Member

Perhaps #640 is the final fix.

Handling built-in warning as https://docs.python.org/3/library/warnings.html could be a workaround.

@jay0129
Copy link
Author

jay0129 commented Jan 27, 2022

@KazuCocoa , I tested on the latest version which is 2.1.2, but it still has the warning problem.

@KazuCocoa
Copy link
Member

The #640 is an open issue.

Did you try the below before calling a new session request as the above link of warnings?

import warnings
warnings.simplefilter("ignore")

@jay0129
Copy link
Author

jay0129 commented Jan 28, 2022

Ok.
I just suppress the warning as for now. Thank you for your support!

 with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=DeprecationWarning)
            self.driver = webdriver.Remote(self.hub_url, self.caps, keep_alive=False)

@f00dog-x300
Copy link

My solution is to add this in my pytest.ini file.
pytest.ini

[pytest]
filterwarnings = 
    # Appium team is aware of deprecation warning - https://github.com/appium/python-client/issues/680
    ignore::DeprecationWarning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants