python——Appium中 setCapability的各种方法

https://www.cnblogs.com/xiaobaibailongma/p/13061701.html

1、

desired_caps = {'platformName': 'Windows',
'deviceName': 'WindowsPC',
'ms:waitForAppLaunch': '125',
'app': "G:\\desktop\\start\\start.exe"}

try :
self.driver = webdriver.Remote('http://{}:{}'.format(host, port), desired_caps)

2、failed to locate opened application window with appid python 打包的exe

研究了一番,猜测是因为桌面应用启动的太慢导致web driver在默认时间内找不到应用。然后看了下在1.2RC的comment里说capabitlity新增了一个参数ms:waitForAppLaunch(https://github.com/microsoft/WinAppDriver/releases/tag/v1.2-RC),可以延迟web driver搜索这个应用的时间。试了一下,奏效了。

 

 

 

    1. The ms:experimental-webdriver capability enables experimental features and optimizations - for this release, enabling this capability will provide performance improvements with XPath and improve overall element handling.
      C#: appCapabilities.SetCapability("ms:experimental-webdriver", true);

    2. The ms:waitForAppLaunch capability enables WinAppDriver to wait for a defined amount of time after an app launch is initiated prior to attaching to the application session. The limit for this is 50 seconds.
      C#: appCapabilities.SetCapability("ms:waitForAppLaunch", "25"); to add app delay of 25 seconds.

posted @ 2022-04-16 09:00  734969  阅读(175)  评论(0)    收藏  举报