TA的每日心情 | 无聊 2024-7-29 11:15 |
---|
签到天数: 32 天 连续签到: 1 天 [LV.5]测试团长
|
2#
楼主 |
发表于 2023-7-21 10:17:48
|
只看该作者
6.2appium-python-client2.11.1+selenium4.10
- <font size="3"> # TODO: Remove the deprecated arg
- desired_capabilities: Optional[Dict] = None,
-
- if desired_capabilities is not None:
- warnings.warn(
- 'desired_capabilities argument is deprecated and will be removed in future versions. '
- 'Use options instead.',
- DeprecationWarning,
- )</font>
复制代码
- <font size="3"> super().__init__(
- command_executor=command_executor,
- options=dst_options,
- )</font>
复制代码
[backcolor=rgba(255, 255, 255, 0.9)]完整代码片段如下- <font size="3">class WebDriver(
- webdriver.Remote,
- ActionHelpers,
- Activities,
- Applications,
- Clipboard,
- Context,
- Common,
- DeviceTime,
- Display,
- ExecuteDriver,
- ExecuteMobileCommand,
- Gsm,
- HardwareActions,
- ImagesComparison,
- IME,
- Keyboard,
- Location,
- LogEvent,
- Network,
- Performance,
- Power,
- RemoteFS,
- ScreenRecord,
- Session,
- Settings,
- Sms,
- SystemBars,
- ):
- def __init__(
- self,
- command_executor: Union[str, AppiumConnection] = 'http://127.0.0.1:4444/wd/hub',
- # TODO: Remove the deprecated arg
- desired_capabilities: Optional[Dict] = None,
- # TODO: Remove the deprecated arg
- browser_profile: Union[str, None] = None,
- # TODO: Remove the deprecated arg
- proxy: Union[str, None] = None,
- keep_alive: bool = True,
- direct_connection: bool = True,
- extensions: Optional[List['WebDriver']] = None,
- strict_ssl: bool = True,
- options: Union[AppiumOptions, List[AppiumOptions], None] = None,
- ):
- if strict_ssl is False:
- # pylint: disable=E1101
- # noinspection PyPackageRequirements
- import urllib3
- # pylint: disable=E1101
- # noinspection PyPackageRequirements
- import urllib3.exceptions
- # noinspection PyUnresolvedReferences
- AppiumConnection.set_certificate_bundle_path(None)
- urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
- if isinstance(command_executor, str):
- command_executor = AppiumConnection(command_executor, keep_alive=keep_alive)
- if browser_profile is not None:
- warnings.warn('browser_profile argument is deprecated and has no effect', DeprecationWarning)
- if proxy is not None:
- warnings.warn('proxy argument is deprecated and has no effect', DeprecationWarning)
- if desired_capabilities is not None:
- warnings.warn(
- 'desired_capabilities argument is deprecated and will be removed in future versions. '
- 'Use options instead.',
- DeprecationWarning,
- )
- # TODO: Remove the fallback after desired_capabilities removal
- dst_options = (
- AppiumOptions().load_capabilities(desired_capabilities)
- if desired_capabilities is not None and options is None
- else options
- )
- super().__init__(
- command_executor=command_executor,
- options=dst_options,
- )</font>
复制代码 6.3appium-python-client2.6.0+selenium4.3.0
- <font size="3">class WebDriver(BaseWebDriver):
- _web_element_cls = WebElement
- _shadowroot_cls = ShadowRoot
- def __init__(self, command_executor='http://127.0.0.1:4444',
- desired_capabilities=None, browser_profile=None, proxy=None,
- keep_alive=True, file_detector=None, options: Union[BaseOptions, List[BaseOptions]] = None):</font>
复制代码 7.0总结:
- 最新版本appium-python-client即将不提供desired_capabilities的传参,但目前能用
- 在selenium4.10中已经不支持desired_capabilities参数
- 错误的搭配可能会引发上述问题,要么用最新的版本(默认安装),要么2个都用较低的版本
- 留在最后的问题,那么在appium最新版中应该如何传递能力值呢?
- <font size="3">from appium import webdriver
- from appium.options.common import AppiumOptions
- option = AppiumOptions()
- option.set_capability('platformName','android')
- driver = webdriver.Remote(command_executor='http://127.0.0.1:4723/wd/hub',
- options=option)</font>
复制代码
|
|