Sumanth Suvarna
Sumanth Suvarna

Reputation: 61

With desired capabilities is deprecated in Selenium 4, how to automate Windows desktop application using Winium in Python 3?

The following code no longer works in Python Selenium 4 since "desired capabilities" is deprecated.

driver = webdriver.Remote(
    command_executor='http://localhost:9999',
    desired_capabilities={
        "app": r"C:\Windows\System32\control.exe",
        "platformName": "Windows", "deviceName": "WindowsPC"
    })

I'm seeing below error when I run it.

C:\Learning\Pytest\PytestBasics\Test.py:23: DeprecationWarning: desired_capabilities has been deprecated, please pass in an Options object with options kwarg driver = webdriver.Remote( Message: Object reference not set to an instance of an object. Stacktrace: at Winium.Desktop.Driver.CommandExecutors.NewSessionExecutor.DoImpl() at Winium.Desktop.Driver.CommandExecutors.CommandExecutorBase.Do()

How shall I make this work? I understand, in Java, I can use DesktopOptions class, but how to do it in Python? I'm stuck at the moment & didn't find any answers over the internet. Any help is greatly appreciated.

Regards,

Upvotes: 3

Views: 596

Answers (0)

Related Questions