From fc6bb5bf02f0435dae392bffa1370106a6ac35e1 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Mon, 14 Dec 2020 10:45:23 -0800 Subject: [PATCH 01/49] bump selenium --- Pipfile | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Pipfile b/Pipfile index 17f158972..2d01ff467 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true pre-commit = "~=2.6" [packages] -selenium = "~=3.141" +selenium = "==4.0.0.a7" autopep8 = "~=1.5" diff --git a/setup.py b/setup.py index d3b6f507d..f18eea325 100644 --- a/setup.py +++ b/setup.py @@ -53,5 +53,5 @@ 'Topic :: Software Development :: Quality Assurance', 'Topic :: Software Development :: Testing' ], - install_requires=['selenium >= 3.14.1, < 4'] + install_requires=['selenium == 4.0.0.a7'] ) From 3d91f069d9b1cc0f6c0310d06ce5dcb28c86c187 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Mon, 14 Dec 2020 17:43:08 -0800 Subject: [PATCH 02/49] Fix lint, CI and tests --- Pipfile | 2 +- README.md | 19 ++++++++ appium/webdriver/appium_connection.py | 19 +++++++- appium/webdriver/common/multi_action.py | 2 +- appium/webdriver/common/touch_action.py | 2 +- appium/webdriver/webdriver.py | 43 ++++++++++--------- ci-jobs/functional/run_appium.yml | 2 + test/functional/android/helper/test_helper.py | 2 +- test/functional/ios/safari_tests.py | 12 +++++- test/unit/helper/test_helper.py | 3 +- test/unit/webdriver/webdriver_test.py | 3 +- 11 files changed, 80 insertions(+), 29 deletions(-) diff --git a/Pipfile b/Pipfile index 2d01ff467..70cf895d8 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true pre-commit = "~=2.6" [packages] -selenium = "==4.0.0.a7" +selenium = "4.0.0.a7" autopep8 = "~=1.5" diff --git a/README.md b/README.md index 5a196a9cb..ad19f26cc 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,25 @@ desired_caps = dict( self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, direct_connection=True) ``` +## Relax SSL validation + +`strict_ssl` option allows you to send commands to an invalid certificate host like self-certificated SSL. + +```python +import unittest +from appium import webdriver + +desired_caps = dict( + platformName='iOS', + platformVersion='13.4', + automationName='xcuitest', + deviceName='iPhone Simulator', + app=PATH('../../apps/UICatalog.app.zip') +) + +self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, strict_ssl=False) +``` + ## Documentation https://appium.github.io/python-client-sphinx/ is detailed documentation diff --git a/appium/webdriver/appium_connection.py b/appium/webdriver/appium_connection.py index f643a168d..d988245c3 100644 --- a/appium/webdriver/appium_connection.py +++ b/appium/webdriver/appium_connection.py @@ -13,8 +13,9 @@ # limitations under the License. import uuid -from typing import TYPE_CHECKING, Any, Dict +from typing import TYPE_CHECKING, Any, Dict, Union +import urllib3 from selenium.webdriver.remote.remote_connection import RemoteConnection from appium.common.helper import library_version @@ -25,6 +26,22 @@ class AppiumConnection(RemoteConnection): + def _get_connection_manager(self) -> Union[urllib3.PoolManager, urllib3.ProxyManager]: + # https://github.com/SeleniumHQ/selenium/blob/0e0194b0e52a34e7df4b841f1ed74506beea5c3e/py/selenium/webdriver/remote/remote_connection.py#L134 + pool_manager_init_args = { + 'timeout': self._timeout + } + # pylint: disable=E1101 + if self._ca_certs: + pool_manager_init_args['cert_reqs'] = 'CERT_REQUIRED' + pool_manager_init_args['ca_certs'] = self._ca_certs + else: + # This line is necessary to disable certificate verification + pool_manager_init_args['cert_reqs'] = 'CERT_NONE' + + return urllib3.PoolManager(**pool_manager_init_args) if self._proxy_url is None else \ + urllib3.ProxyManager(self._proxy_url, **pool_manager_init_args) + @classmethod def get_remote_connection_headers(cls, parsed_url: 'ParseResult', keep_alive: bool = True) -> Dict[str, Any]: """Override get_remote_connection_headers in RemoteConnection""" diff --git a/appium/webdriver/common/multi_action.py b/appium/webdriver/common/multi_action.py index 6cb4f4d78..6b2d1574c 100644 --- a/appium/webdriver/common/multi_action.py +++ b/appium/webdriver/common/multi_action.py @@ -24,9 +24,9 @@ from appium.webdriver.mobilecommand import MobileCommand as Command if TYPE_CHECKING: + from appium.webdriver.common.touch_action import TouchAction from appium.webdriver.webdriver import WebDriver from appium.webdriver.webelement import WebElement - from appium.webdriver.common.touch_action import TouchAction T = TypeVar('T', bound='MultiAction') diff --git a/appium/webdriver/common/touch_action.py b/appium/webdriver/common/touch_action.py index e068d4990..547287889 100644 --- a/appium/webdriver/common/touch_action.py +++ b/appium/webdriver/common/touch_action.py @@ -29,8 +29,8 @@ from appium.webdriver.mobilecommand import MobileCommand as Command if TYPE_CHECKING: - from appium.webdriver.webelement import WebElement from appium.webdriver.webdriver import WebDriver + from appium.webdriver.webelement import WebElement T = TypeVar('T', bound='TouchAction') diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index 72d0dafe1..c95294e85 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -146,7 +146,18 @@ class WebDriver( ): def __init__(self, command_executor: str = 'http://127.0.0.1:4444/wd/hub', - desired_capabilities: Optional[Dict] = None, browser_profile: str = None, proxy: str = None, keep_alive: bool = True, direct_connection: bool = False): + desired_capabilities: Optional[Dict] = None, + browser_profile: str = None, + proxy: str = None, + keep_alive: bool = True, + direct_connection: bool = True, + strict_ssl: bool = True): + + if strict_ssl is False: + # pylint: disable=E1101 + import urllib3 + AppiumConnection.set_certificate_bundle_path(None) + urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) super().__init__( AppiumConnection(command_executor, keep_alive=keep_alive), @@ -182,17 +193,17 @@ def _update_command_executor(self, keep_alive: bool) -> None: direct_port = 'directConnectPort' direct_path = 'directConnectPath' - if (not {direct_protocol, direct_host, direct_port, direct_path}.issubset(set(self.capabilities))): + if (not {direct_protocol, direct_host, direct_port, direct_path}.issubset(set(self.caps))): message = 'Direct connect capabilities from server were:\n' for key in [direct_protocol, direct_host, direct_port, direct_path]: - message += '{}: \'{}\'\n'.format(key, self.capabilities.get(key, '')) + message += '{}: \'{}\'\n'.format(key, self.caps.get(key, '')) logger.warning(message) return - protocol = self.capabilities[direct_protocol] - hostname = self.capabilities[direct_host] - port = self.capabilities[direct_port] - path = self.capabilities[direct_path] + protocol = self.caps[direct_protocol] + hostname = self.caps[direct_host] + port = self.caps[direct_port] + path = self.caps[direct_path] executor = f'{protocol}://{hostname}:{port}{path}' logger.info('Updated request endpoint to %s', executor) @@ -200,6 +211,7 @@ def _update_command_executor(self, keep_alive: bool) -> None: self.command_executor = RemoteConnection(executor, keep_alive=keep_alive) self._addCommands() + # https://github.com/SeleniumHQ/selenium/blob/06fdf2966df6bca47c0ae45e8201cd30db9b9a49/py/selenium/webdriver/remote/webdriver.py#L277 def start_session(self, capabilities: Dict, browser_profile: Optional[str] = None) -> None: """Creates a new session with the desired capabilities. @@ -226,12 +238,12 @@ def start_session(self, capabilities: Dict, browser_profile: Optional[str] = Non if 'sessionId' not in response: response = response['value'] self.session_id = response['sessionId'] - self.capabilities = response.get('value') + self.caps = response.get('value') # if capabilities is none we are probably speaking to # a W3C endpoint - if self.capabilities is None: - self.capabilities = response.get('capabilities') + if self.caps is None: + self.caps = response.get('capabilities') # Double check to see if we have a W3C Compliant browser self.w3c = response.get('status') is None @@ -240,13 +252,6 @@ def start_session(self, capabilities: Dict, browser_profile: Optional[str] = Non def _merge_capabilities(self, capabilities: Dict) -> Dict[str, Any]: """Manage capabilities whether W3C format or MJSONWP format """ - if _FORCE_MJSONWP in capabilities: - force_mjsonwp = capabilities[_FORCE_MJSONWP] - del capabilities[_FORCE_MJSONWP] - - if force_mjsonwp != False: - return {'desiredCapabilities': capabilities} - w3c_caps = _make_w3c_caps(capabilities) return {'capabilities': w3c_caps, 'desiredCapabilities': capabilities} @@ -263,7 +268,6 @@ def find_element(self, by: str = By.ID, value: Union[str, Dict] = None) -> Mobil """ # TODO: If we need, we should enable below converter for Web context - # if self.w3c: # if by == By.ID: # by = By.CSS_SELECTOR # value = '[id="%s"]' % value @@ -293,7 +297,6 @@ def find_elements(self, by: str = By.ID, value: Union[str, Dict] :obj:`list` of :obj:`appium.webdriver.webelement.WebElement`: The found elements """ # TODO: If we need, we should enable below converter for Web context - # if self.w3c: # if by == By.ID: # by = By.CSS_SELECTOR # value = '[id="%s"]' % value @@ -313,7 +316,7 @@ def find_elements(self, by: str = By.ID, value: Union[str, Dict] 'using': by, 'value': value})['value'] or [] - def create_web_element(self, element_id: Union[int, str], w3c: bool = False) -> MobileWebElement: + def create_web_element(self, element_id: Union[int, str], w3c: bool = True) -> MobileWebElement: """Creates a web element with the specified element_id. Overrides method in Selenium WebDriver in order to always give them diff --git a/ci-jobs/functional/run_appium.yml b/ci-jobs/functional/run_appium.yml index c9b21b0ca..aa0e4c94c 100644 --- a/ci-jobs/functional/run_appium.yml +++ b/ci-jobs/functional/run_appium.yml @@ -13,6 +13,8 @@ steps: versionSpec: '3.x' - script: brew install ffmpeg displayName: Resolve dependencies (Appium server) +- script: pip install trio==0.17.0 + displayName: Install python language bindings for Appium - script: python setup.py install displayName: Install python language bindings for Appium - script: | diff --git a/test/functional/android/helper/test_helper.py b/test/functional/android/helper/test_helper.py index c964ae8b3..0197bad1a 100644 --- a/test/functional/android/helper/test_helper.py +++ b/test/functional/android/helper/test_helper.py @@ -26,8 +26,8 @@ from . import desired_capabilities if TYPE_CHECKING: - from appium.webdriver.webelement import WebElement from appium.webdriver.webdriver import WebDriver + from appium.webdriver.webelement import WebElement # the emulator is sometimes slow and needs time to think SLEEPY_TIME = 10 diff --git a/test/functional/ios/safari_tests.py b/test/functional/ios/safari_tests.py index 23d907fc7..0a9d27725 100644 --- a/test/functional/ios/safari_tests.py +++ b/test/functional/ios/safari_tests.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import time + from appium import webdriver from .helper.desired_capabilities import get_desired_capabilities @@ -38,4 +40,12 @@ def test_context(self) -> None: def test_get(self) -> None: self.driver.get("http://google.com") - assert 'Google' == self.driver.title + for _ in range(5): + time.sleep(0.5) + try: + assert 'Google' == self.driver.title + return + except Exception: + pass + + assert False, 'The title was wrong' diff --git a/test/unit/helper/test_helper.py b/test/unit/helper/test_helper.py index b33d3a929..8dd54235d 100644 --- a/test/unit/helper/test_helper.py +++ b/test/unit/helper/test_helper.py @@ -23,9 +23,10 @@ SERVER_URL_BASE = 'http://localhost:4723/wd/hub' if TYPE_CHECKING: - from appium.webdriver.webdriver import WebDriver from httpretty.core import HTTPrettyRequestEmpty + from appium.webdriver.webdriver import WebDriver + def appium_command(command: str) -> str: """Return a command of Appium diff --git a/test/unit/webdriver/webdriver_test.py b/test/unit/webdriver/webdriver_test.py index 87e45d18e..701a9a055 100644 --- a/test/unit/webdriver/webdriver_test.py +++ b/test/unit/webdriver/webdriver_test.py @@ -89,7 +89,7 @@ def test_create_session_forceMjsonwp(self): assert 'appium/python {} (selenium'.format(appium_version.version) in request.headers['user-agent'] request_json = json.loads(httpretty.HTTPretty.latest_requests[0].body.decode('utf-8')) - assert request_json.get('capabilities') is None + assert request_json.get('capabilities') is not None assert request_json.get('desiredCapabilities') is not None assert driver.session_id == 'session-id' @@ -269,7 +269,6 @@ def exceptionCallback(request, uri, headers): body=exceptionCallback ) events = driver.events - mock_warning.assert_called_once() assert events == {} From b7fe6dc701f56309068fc0eb72c0974a1b98eca8 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 19 Dec 2020 00:45:30 -0800 Subject: [PATCH 03/49] Update changelog for v2.0.0.a0 --- CHANGELOG.rst | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e8edf1937..018947aba 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,53 @@ Changelog ========= +(unreleased) +------------ + +New +~~~ +- Feat: Added descriptions for newly added screenrecord opts (#540) + [Mori Atsushi] + + * Add description for newly added opts for screen record + + * Updates + +Fix +~~~ +- Fix lint, CI and tests. [Kazuaki Matsuo] + +Test +~~~~ +- Ci: move azure project to Appium CI, update readme (#564) [Kazuaki + Matsuo] +- Ci: Added py39-dev for travis (#557) [Mori Atsushi] + + * ci: Added py39-dev + + * Add xv option for debug + + * [debug] pip list + + * Avoid error in py39 + + * Updated modules in pre-commit +- Ci: upgrade xcode and macos (#556) [Mori Atsushi] + + * ci: upgrade xcode ver and macos + + * Upgrade iOS ver for functional tests + + * Changed xcode to 11.6 + +Other +~~~~~ +- Chore: address selenium-4 branch in readme (#566) [Kazuaki Matsuo] +- Bump selenium. [Kazuaki Matsuo] +- Docs: fix wrong code example in README.md (#555) [sanlengjingvv] +- Update changelog for 1.0.2. [Kazuaki Matsuo] + + v1.0.2 (2020-07-15) ------------------- - Bump 1.0.2. [Kazuaki Matsuo] From 5a8a7dfc4fdae1c6d4d9d2a9e75bbe90a9c18be6 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 19 Dec 2020 00:48:31 -0800 Subject: [PATCH 04/49] Bump v2.0.0.a0 --- README.md | 2 ++ appium/version.py | 2 +- script/release.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f9cbf336a..5806d9d9c 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ Since **v1.0.0**, only Python 3 is supported Main differences since current v1 is the v2 can connect to invalid SSL environment like self-certificated server. Please take a look at the branch's README for more details. +Please install lower version of `trio` like `pip install trio==0.17.0` if your environment failed to install `trio` dependency. + ## Getting the Appium Python client There are three ways to install and use the Appium Python client. diff --git a/appium/version.py b/appium/version.py index 4eda78c41..0f964690f 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '1.0.2' +version = '2.0.0.a0' diff --git a/script/release.py b/script/release.py index 93381cd68..d5eb3d545 100644 --- a/script/release.py +++ b/script/release.py @@ -62,13 +62,13 @@ def call_bash_script(cmd): def commit_version_code(new_version_num): - call_bash_script('git commit {} -m "Bump {}"'.format(VERSION_FILE_PATH, new_version_num)) + call_bash_script('git commit -n {} -m "Bump {}"'.format(VERSION_FILE_PATH, new_version_num)) def tag_and_generate_changelog(new_version_num): call_bash_script('git tag "v{}"'.format(new_version_num)) call_bash_script('gitchangelog > {}'.format(CHANGELOG_PATH)) - call_bash_script('git commit {} -m "Update changelog for {}"'.format(CHANGELOG_PATH, new_version_num)) + call_bash_script('git commit -n {} -m "Update changelog for {}"'.format(CHANGELOG_PATH, new_version_num)) def upload_sdist(new_version_num): From 246d349c8c9743fd495cde98425872d2aad9e5a5 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 21 Mar 2021 18:32:51 -0700 Subject: [PATCH 05/49] fix format with black --- appium/webdriver/appium_connection.py | 12 ++++++------ appium/webdriver/webdriver.py | 24 +++++++++++++----------- setup.py | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/appium/webdriver/appium_connection.py b/appium/webdriver/appium_connection.py index d988245c3..eb218b994 100644 --- a/appium/webdriver/appium_connection.py +++ b/appium/webdriver/appium_connection.py @@ -25,12 +25,9 @@ class AppiumConnection(RemoteConnection): - def _get_connection_manager(self) -> Union[urllib3.PoolManager, urllib3.ProxyManager]: # https://github.com/SeleniumHQ/selenium/blob/0e0194b0e52a34e7df4b841f1ed74506beea5c3e/py/selenium/webdriver/remote/remote_connection.py#L134 - pool_manager_init_args = { - 'timeout': self._timeout - } + pool_manager_init_args = {'timeout': self._timeout} # pylint: disable=E1101 if self._ca_certs: pool_manager_init_args['cert_reqs'] = 'CERT_REQUIRED' @@ -39,8 +36,11 @@ def _get_connection_manager(self) -> Union[urllib3.PoolManager, urllib3.ProxyMan # This line is necessary to disable certificate verification pool_manager_init_args['cert_reqs'] = 'CERT_NONE' - return urllib3.PoolManager(**pool_manager_init_args) if self._proxy_url is None else \ - urllib3.ProxyManager(self._proxy_url, **pool_manager_init_args) + return ( + urllib3.PoolManager(**pool_manager_init_args) + if self._proxy_url is None + else urllib3.ProxyManager(self._proxy_url, **pool_manager_init_args) + ) @classmethod def get_remote_connection_headers(cls, parsed_url: 'ParseResult', keep_alive: bool = True) -> Dict[str, Any]: diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index 40053a356..8285361bd 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -142,18 +142,21 @@ class WebDriver( Sms, SystemBars, ): - - def __init__(self, command_executor: str = 'http://127.0.0.1:4444/wd/hub', - desired_capabilities: Optional[Dict] = None, - browser_profile: str = None, - proxy: str = None, - keep_alive: bool = True, - direct_connection: bool = True, - strict_ssl: bool = True): + def __init__( + self, + command_executor: str = 'http://127.0.0.1:4444/wd/hub', + desired_capabilities: Optional[Dict] = None, + browser_profile: str = None, + proxy: str = None, + keep_alive: bool = True, + direct_connection: bool = True, + strict_ssl: bool = True, + ): if strict_ssl is False: # pylint: disable=E1101 import urllib3 + AppiumConnection.set_certificate_bundle_path(None) urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) @@ -187,7 +190,7 @@ def _update_command_executor(self, keep_alive: bool) -> None: direct_port = 'directConnectPort' direct_path = 'directConnectPath' - if (not {direct_protocol, direct_host, direct_port, direct_path}.issubset(set(self.caps))): + if not {direct_protocol, direct_host, direct_port, direct_path}.issubset(set(self.caps)): message = 'Direct connect capabilities from server were:\n' for key in [direct_protocol, direct_host, direct_port, direct_path]: message += '{}: \'{}\'\n'.format(key, self.caps.get(key, '')) @@ -244,8 +247,7 @@ def start_session(self, capabilities: Dict, browser_profile: Optional[str] = Non self.command_executor.w3c = self.w3c def _merge_capabilities(self, capabilities: Dict) -> Dict[str, Any]: - """Manage capabilities whether W3C format or MJSONWP format - """ + """Manage capabilities whether W3C format or MJSONWP format""" w3c_caps = _make_w3c_caps(capabilities) return {'capabilities': w3c_caps, 'desiredCapabilities': capabilities} diff --git a/setup.py b/setup.py index 4f02379d2..72d6b6451 100644 --- a/setup.py +++ b/setup.py @@ -47,5 +47,5 @@ 'Topic :: Software Development :: Quality Assurance', 'Topic :: Software Development :: Testing', ], - install_requires=['selenium == 4.0.0.b2.post1'] + install_requires=['selenium == 4.0.0.b2.post1'], ) From b35577e7b67ad348902f5eeab35f2acd2178a2dd Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 21 Mar 2021 21:55:45 -0700 Subject: [PATCH 06/49] bump base selenium version to 4.0.0.b2 --- appium/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/version.py b/appium/version.py index 0f964690f..9ec2fefdb 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.a0' +version = '2.0.0.b0' From 4b74be2674eaf46cffd429d1728cc3f37c259166 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 3 Apr 2021 03:04:22 +0900 Subject: [PATCH 07/49] fix: remove w3c argument in MobileWebElement (#598) * Bump 2.0.0.b1 * Update changelog for 2.0.0.b1 * remove w3c --- CHANGELOG.rst | 189 +++++++++++++++++++++++++++++++++- appium/version.py | 2 +- appium/webdriver/webdriver.py | 5 +- 3 files changed, 187 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 018947aba..0aec2170b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,8 +5,48 @@ Changelog (unreleased) ------------ +Fix +~~~ +- Fix format with black. [Kazuaki Matsuo] +- Fix lint, CI and tests. [Kazuaki Matsuo] + +Other +~~~~~ +- Bump 2.0.0.b1. [Kazuaki Matsuo] +- Bump base selenium version to 4.0.0.b2. [Kazuaki Matsuo] +- Bump v2.0.0.a0. [Kazuaki Matsuo] +- Update changelog for v2.0.0.a0. [Kazuaki Matsuo] +- Bump selenium. [Kazuaki Matsuo] + + +v1.1.0 (2021-03-10) +------------------- + New ~~~ +- Feat: Add optional location speed attribute for android devices (#594) + [salabogdan] +- Feat: Added docstring for macOS screenrecord option (#580) [Mori + Atsushi] + + * Added docstring for macOS screenrecord option + + * tweak + + * review comment +- Feat: add warning to drop forceMjsonwp for W3C (#567) [Kazuaki Matsuo] + + * tweak + + * fix test + + * print warning + + * revert test + + * Update webdriver.py + + * fix autopep8 - Feat: Added descriptions for newly added screenrecord opts (#540) [Mori Atsushi] @@ -14,12 +54,32 @@ New * Updates -Fix -~~~ -- Fix lint, CI and tests. [Kazuaki Matsuo] - Test ~~~~ +- Ci: Use node v12 (#585) [Mori Atsushi] + + * Use node 12 on ci + + * Update copyright + + * Update README for doc + + * tweak + + * fix copyright + + * try py310 + + * remove py310 +- Ci: remove travis (#581) [Mori Atsushi] + + * Removed travis and run unit test on azure + + * review comment + + * run tox on azure pipelines + + * removed tox-travis from pipfile - Ci: move azure project to Appium CI, update readme (#564) [Kazuaki Matsuo] - Ci: Added py39-dev for travis (#557) [Mori Atsushi] @@ -43,8 +103,127 @@ Test Other ~~~~~ +- Chore(deps-dev): update pre-commit requirement from ~=2.10 to ~=2.11 + (#595) [dependabot[bot]] + + Updates the requirements on [pre-commit](https://github.com/pre-commit/pre-commit) to permit the latest version. + - [Release notes](https://github.com/pre-commit/pre-commit/releases) + - [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md) + - [Commits](https://github.com/pre-commit/pre-commit/compare/v2.10.0...v2.11.0) +- Chore(deps): update tox requirement from ~=3.22 to ~=3.23 (#593) + [dependabot[bot]] + + Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. + - [Release notes](https://github.com/tox-dev/tox/releases) + - [Changelog](https://github.com/tox-dev/tox/blob/3.23.0/docs/changelog.rst) + - [Commits](https://github.com/tox-dev/tox/compare/3.22.0...3.23.0) +- Chore(deps): update pylint requirement from ~=2.6 to ~=2.7 (#588) + [Mori Atsushi, dependabot[bot]] + + Updates the requirements on [pylint](https://github.com/PyCQA/pylint) to permit the latest version. + - [Release notes](https://github.com/PyCQA/pylint/releases) + - [Changelog](https://github.com/PyCQA/pylint/blob/master/ChangeLog) + - [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.6.0...pylint-2.7.0) +- Chore(deps): update astroid requirement from ~=2.4 to ~=2.5 (#587) + [dependabot[bot]] + + Updates the requirements on [astroid](https://github.com/PyCQA/astroid) to permit the latest version. + - [Release notes](https://github.com/PyCQA/astroid/releases) + - [Changelog](https://github.com/PyCQA/astroid/blob/master/ChangeLog) + - [Commits](https://github.com/PyCQA/astroid/compare/astroid-2.4.0...astroid-2.5) +- Chore(deps): update mypy requirement from ~=0.800 to ~=0.812 (#589) + [Mori Atsushi, dependabot[bot]] + + * chore(deps): update mypy requirement from ~=0.800 to ~=0.812 + + Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version. + - [Release notes](https://github.com/python/mypy/releases) + - [Commits](https://github.com/python/mypy/compare/v0.800...v0.812) + + Signed-off-by: dependabot[bot] + + * Fix mypy error with mypy v0.812 (#590) + + * chore(deps): update mypy requirement from ~=0.800 to ~=0.812 + + Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version. + - [Release notes](https://github.com/python/mypy/releases) + - [Commits](https://github.com/python/mypy/compare/v0.800...v0.812) +- Chore(deps): update tox requirement from ~=3.21 to ~=3.22 (#586) + [dependabot[bot]] + + Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. + - [Release notes](https://github.com/tox-dev/tox/releases) + - [Changelog](https://github.com/tox-dev/tox/blob/master/docs/changelog.rst) + - [Commits](https://github.com/tox-dev/tox/compare/3.21.0...3.22.0) +- Chore: Add table for screen_record kwarg (#582) [Mori Atsushi] + + * Add table for kwarg + + * update + + * Add missing doc to stop_recording + + * Push auto-generated changes by sphinx + + * delete duplicated entry [skip ci] +- Chore(deps): update isort requirement from ~=5.0 to ~=5.7 (#578) + [dependabot-preview[bot]] + + Updates the requirements on [isort](https://github.com/pycqa/isort) to permit the latest version. + - [Release notes](https://github.com/pycqa/isort/releases) + - [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md) + - [Commits](https://github.com/pycqa/isort/compare/5.0.0...5.7.0) +- Create Dependabot config file (#579) [dependabot-preview[bot], + dependabot-preview[bot]] +- Chore: Update pipfile to respect isort v5 (#577) [Mori Atsushi] +- Chore: Fix iOS app management functional tests (#575) [Mori Atsushi] + + * Added sleep to wait the app has gone + + * Upgrade AndroidSDK to 30 from 27 + + * Added sleep to ios tc + + * Fix android activities test + + * Revert android sdk ver + + * Used timer instead of fixed wait time + + * Created wait_for + + * Update test/functional/test_helper.py + + * review comments + + * review comments + + * Extend callable type + + * fix + + * review comment + + * review comment + + * review comment + + * fix comment +- Chore: Fix functional keyboard tests with appium v1.21.0-beta.0 (#574) + [Mori Atsushi] + + * Fix function keyboard tests + + * Updated class name for keyboard +- Chore: Apply Black code formatter (#571) [Mori Atsushi] + + * Applied black (length: 120, String skipped) + + * Updated related to ci + + * Update README - Chore: address selenium-4 branch in readme (#566) [Kazuaki Matsuo] -- Bump selenium. [Kazuaki Matsuo] - Docs: fix wrong code example in README.md (#555) [sanlengjingvv] - Update changelog for 1.0.2. [Kazuaki Matsuo] diff --git a/appium/version.py b/appium/version.py index 9ec2fefdb..b3a41c69d 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.b0' +version = '2.0.0.b1' diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index 8285361bd..ba9317527 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -307,7 +307,7 @@ def find_elements(self, by: str = By.ID, value: Union[str, Dict] = None) -> Unio return self.execute(RemoteCommand.FIND_ELEMENTS, {'using': by, 'value': value})['value'] or [] - def create_web_element(self, element_id: Union[int, str], w3c: bool = True) -> MobileWebElement: + def create_web_element(self, element_id: Union[int, str]) -> MobileWebElement: """Creates a web element with the specified element_id. Overrides method in Selenium WebDriver in order to always give them @@ -315,12 +315,11 @@ def create_web_element(self, element_id: Union[int, str], w3c: bool = True) -> M Args: element_id: The element id to create a web element - w3c: Whether the element is W3C or MJSONWP Returns: `MobileWebElement` """ - return MobileWebElement(self, element_id, w3c) + return MobileWebElement(self, element_id) def set_value(self, element: MobileWebElement, value: str) -> T: """Set the value on an element in the application. From 69c4561d11f6565e1d0d463dec698a96cd6b811a Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 2 Apr 2021 11:11:18 -0700 Subject: [PATCH 08/49] Bump 2.0.0.b2 --- appium/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/version.py b/appium/version.py index b3a41c69d..fe3812d45 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.b1' +version = '2.0.0.b2' From c444d578f5b30db92bc2a64be87333e1840f6bcf Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 2 Apr 2021 11:11:23 -0700 Subject: [PATCH 09/49] Update changelog for 2.0.0.b2 --- CHANGELOG.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0aec2170b..f1c89f68d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,12 +7,19 @@ Changelog Fix ~~~ +- Remove w3c argument in MobileWebElement (#598) [Kazuaki Matsuo] + + * Bump 2.0.0.b1 + + * Update changelog for 2.0.0.b1 + + * remove w3c - Fix format with black. [Kazuaki Matsuo] - Fix lint, CI and tests. [Kazuaki Matsuo] Other ~~~~~ -- Bump 2.0.0.b1. [Kazuaki Matsuo] +- Bump 2.0.0.b2. [Kazuaki Matsuo] - Bump base selenium version to 4.0.0.b2. [Kazuaki Matsuo] - Bump v2.0.0.a0. [Kazuaki Matsuo] - Update changelog for v2.0.0.a0. [Kazuaki Matsuo] From f8cf51fb6f2561187c81b798147100e0eb065323 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 4 Apr 2021 17:13:46 -0700 Subject: [PATCH 10/49] update pipfile --- Pipfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pipfile b/Pipfile index 22c097f1f..84b217b85 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true pre-commit = "~=2.11" [packages] -selenium = "4.0.0.a7" +selenium = "4.0.0.b2.post1" black = "==20.8b1" From 1c8ecf17c00b18c236fd1ddc7d6d712577c48045 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 18 Apr 2021 02:12:33 -0700 Subject: [PATCH 11/49] bump selenium 4.0.0.b3 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 72d6b6451..fdef2dac7 100644 --- a/setup.py +++ b/setup.py @@ -47,5 +47,5 @@ 'Topic :: Software Development :: Quality Assurance', 'Topic :: Software Development :: Testing', ], - install_requires=['selenium == 4.0.0.b2.post1'], + install_requires=['selenium == 4.0.0.b3'], ) From 799e155b4538771c7c03697780b082e18011d647 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 24 Apr 2021 11:48:47 -0700 Subject: [PATCH 12/49] update selenium in pipfile --- Pipfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pipfile b/Pipfile index d1ab43a26..cf89507bf 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true pre-commit = "~=2.11" [packages] -selenium = "4.0.0.b2.post1" +selenium = "4.0.0.b3" black = "==20.8b1" From 9d5d4c39f488d24d6457bffd8837e284c55ad0d4 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 24 Apr 2021 13:00:05 -0700 Subject: [PATCH 13/49] tweak some lines --- ci-jobs/functional/run_appium.yml | 2 +- script/release.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-jobs/functional/run_appium.yml b/ci-jobs/functional/run_appium.yml index 1e7864de6..608621b34 100644 --- a/ci-jobs/functional/run_appium.yml +++ b/ci-jobs/functional/run_appium.yml @@ -14,7 +14,7 @@ steps: - script: brew install ffmpeg displayName: Resolve dependencies (Appium server) - script: pip install trio==0.17.0 - displayName: Install python language bindings for Appium + displayName: Install trio - script: python setup.py install displayName: Install python language bindings for Appium - script: | diff --git a/script/release.py b/script/release.py index 3bb5e70d6..9b0f0a83a 100644 --- a/script/release.py +++ b/script/release.py @@ -63,13 +63,13 @@ def call_bash_script(cmd): def commit_version_code(new_version_num): - call_bash_script('git commit -n {} -m "Bump {}"'.format(VERSION_FILE_PATH, new_version_num)) + call_bash_script('git commit {} -m "Bump {}"'.format(VERSION_FILE_PATH, new_version_num)) def tag_and_generate_changelog(new_version_num): call_bash_script('git tag "v{}"'.format(new_version_num)) call_bash_script('gitchangelog > {}'.format(CHANGELOG_PATH)) - call_bash_script('git commit -n {} -m "Update changelog for {}"'.format(CHANGELOG_PATH, new_version_num)) + call_bash_script('git commit {} -m "Update changelog for {}"'.format(CHANGELOG_PATH, new_version_num)) def upload_sdist(new_version_num): From 1e470db8765c78e98af239ba2dadfd188fd13e15 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Tue, 4 May 2021 22:13:01 -0700 Subject: [PATCH 14/49] Bump 2.0.0.b3 --- appium/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/version.py b/appium/version.py index fe3812d45..7800a8d4c 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.b2' +version = '2.0.0.b3' From 8b4c65c58502fcbc67ad3d0f0fdfc9054b5bae74 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Tue, 4 May 2021 22:13:09 -0700 Subject: [PATCH 15/49] Update changelog for 2.0.0.b3 --- CHANGELOG.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f1c89f68d..4b2328563 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,19 @@ Fix Other ~~~~~ +- Bump 2.0.0.b3. [Kazuaki Matsuo] +- Tweak some lines. [Kazuaki Matsuo] +- Update selenium in pipfile. [Kazuaki Matsuo] +- Chore(deps): update isort requirement from ~=5.7 to ~=5.8 (#596) + [dependabot[bot]] + + Updates the requirements on [isort](https://github.com/pycqa/isort) to permit the latest version. + - [Release notes](https://github.com/pycqa/isort/releases) + - [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md) + - [Commits](https://github.com/pycqa/isort/compare/5.7.0...5.8.0) +- Bump selenium 4.0.0.b3. [Kazuaki Matsuo] +- Update pipfile. [Kazuaki Matsuo] +- Update changelog for 2.0.0.b2. [Kazuaki Matsuo] - Bump 2.0.0.b2. [Kazuaki Matsuo] - Bump base selenium version to 4.0.0.b2. [Kazuaki Matsuo] - Bump v2.0.0.a0. [Kazuaki Matsuo] From f2844d7cce6ae13736ef00a2e2628e58625f43dc Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Mon, 14 Jun 2021 00:51:49 -0700 Subject: [PATCH 16/49] use python selenium client v4.0.0.b4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index fdef2dac7..20c7cb8fa 100644 --- a/setup.py +++ b/setup.py @@ -47,5 +47,5 @@ 'Topic :: Software Development :: Quality Assurance', 'Topic :: Software Development :: Testing', ], - install_requires=['selenium == 4.0.0.b3'], + install_requires=['selenium == 4.0.0.b4'], ) From 30f0d9e2d3cdb429bc84f0bd625b1b14e6063a06 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Mon, 14 Jun 2021 00:53:05 -0700 Subject: [PATCH 17/49] Bump 2.0.0.b4 --- appium/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/version.py b/appium/version.py index 7800a8d4c..e800ff377 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.b3' +version = '2.0.0.b4' From 147a0d898ea74cc7a7a4bfa6419bf6fdf813aa2e Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Mon, 14 Jun 2021 00:53:13 -0700 Subject: [PATCH 18/49] Update changelog for 2.0.0.b4 --- CHANGELOG.rst | 73 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4b2328563..df7e91be3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,16 +19,12 @@ Fix Other ~~~~~ +- Bump 2.0.0.b4. [Kazuaki Matsuo] +- Use python selenium client v4.0.0.b4. [Kazuaki Matsuo] +- Update changelog for 2.0.0.b3. [Kazuaki Matsuo] - Bump 2.0.0.b3. [Kazuaki Matsuo] - Tweak some lines. [Kazuaki Matsuo] - Update selenium in pipfile. [Kazuaki Matsuo] -- Chore(deps): update isort requirement from ~=5.7 to ~=5.8 (#596) - [dependabot[bot]] - - Updates the requirements on [isort](https://github.com/pycqa/isort) to permit the latest version. - - [Release notes](https://github.com/pycqa/isort/releases) - - [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md) - - [Commits](https://github.com/pycqa/isort/compare/5.7.0...5.8.0) - Bump selenium 4.0.0.b3. [Kazuaki Matsuo] - Update pipfile. [Kazuaki Matsuo] - Update changelog for 2.0.0.b2. [Kazuaki Matsuo] @@ -39,6 +35,69 @@ Other - Bump selenium. [Kazuaki Matsuo] +v1.2.0 (2021-06-07) +------------------- + +New +~~~ +- Feat: allow to add a command dynamically (#608) [Kazuaki Matsuo] + + * add add_commmand in python + + * add test + + * add exceptions, tweak method + + * append docstring + + * add $id example + + * use pytest.raises + + * add examples as docstring + +Other +~~~~~ +- Bump 1.2.0. [Kazuaki Matsuo] +- Chore(deps-dev): update pre-commit requirement from ~=2.12 to ~=2.13 + (#607) [dependabot[bot]] + + Updates the requirements on [pre-commit](https://github.com/pre-commit/pre-commit) to permit the latest version. + - [Release notes](https://github.com/pre-commit/pre-commit/releases) + - [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md) + - [Commits](https://github.com/pre-commit/pre-commit/compare/v2.12.0...v2.13.0) +- Chore(deps): update pytest-cov requirement from ~=2.11 to ~=2.12 + (#606) [Kazuaki Matsuo, dependabot[bot]] + + * chore(deps): update pytest-cov requirement from ~=2.11 to ~=2.12 + + Updates the requirements on [pytest-cov](https://github.com/pytest-dev/pytest-cov) to permit the latest version. + - [Release notes](https://github.com/pytest-dev/pytest-cov/releases) + - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) + - [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.11.0...v2.12.0) +- Chore(deps): update pylint requirement from ~=2.7 to ~=2.8 (#600) + [dependabot[bot]] + + Updates the requirements on [pylint](https://github.com/PyCQA/pylint) to permit the latest version. + - [Release notes](https://github.com/PyCQA/pylint/releases) + - [Changelog](https://github.com/PyCQA/pylint/blob/master/ChangeLog) + - [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.7.0...pylint-2.8.1) +- Chore(deps-dev): update pre-commit requirement from ~=2.11 to ~=2.12 + (#599) [dependabot[bot]] + + Updates the requirements on [pre-commit](https://github.com/pre-commit/pre-commit) to permit the latest version. + - [Release notes](https://github.com/pre-commit/pre-commit/releases) + - [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md) + - [Commits](https://github.com/pre-commit/pre-commit/compare/v2.11.0...v2.12.0) +- Chore(deps): update isort requirement from ~=5.7 to ~=5.8 (#596) + [dependabot[bot]] + + Updates the requirements on [isort](https://github.com/pycqa/isort) to permit the latest version. + - [Release notes](https://github.com/pycqa/isort/releases) + - [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md) + - [Commits](https://github.com/pycqa/isort/compare/5.7.0...5.8.0) + + v1.1.0 (2021-03-10) ------------------- From 9e6091b980dd9268074201aebab9841f1cd64277 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 29 Aug 2021 00:08:26 -0700 Subject: [PATCH 19/49] add test to check log path --- test/unit/webdriver/log_test.py | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/unit/webdriver/log_test.py diff --git a/test/unit/webdriver/log_test.py b/test/unit/webdriver/log_test.py new file mode 100644 index 000000000..29ba8b663 --- /dev/null +++ b/test/unit/webdriver/log_test.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json + +import httpretty + +from appium.webdriver.webdriver import WebDriver +from test.unit.helper.test_helper import appium_command, get_httpretty_request_body, ios_w3c_driver + + +class TestWebDriverLog(object): + @httpretty.activate + def test_get_log_types(self): + driver = ios_w3c_driver() + httpretty.register_uri( + httpretty.GET, + appium_command('/session/1234567890/se/log/types'), + body=json.dumps({'value': ['syslog']}), + ) + log_types = driver.log_types + assert log_types == ['syslog'] + + @httpretty.activate + def test_get_log(self): + driver = ios_w3c_driver() + httpretty.register_uri( + httpretty.POST, + appium_command('/session/1234567890/se/log'), + body=json.dumps({'value': ['logs as array']}), + ) + log_types = driver.get_log('syslog') + assert log_types == ['logs as array'] + + d = get_httpretty_request_body(httpretty.last_request()) + assert {'type': 'syslog'} == d From b83b1d0b194b2d97fc1a5ae95f055434e5d3c1ab Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 29 Aug 2021 01:04:32 -0700 Subject: [PATCH 20/49] bump selenium version in tox --- Pipfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pipfile b/Pipfile index 8538de22a..d93a027d6 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true pre-commit = "~=2.13" [packages] -selenium = "4.0.0.b3" +selenium = "4.0.0.b4" black = "==20.8b1" From 53e86229e6d56cbadf15af3cdb1f6a3c0449e7f1 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 29 Aug 2021 01:24:28 -0700 Subject: [PATCH 21/49] override log --- appium/webdriver/mobilecommand.py | 4 ++++ appium/webdriver/webdriver.py | 5 +++++ test/unit/webdriver/log_test.py | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/appium/webdriver/mobilecommand.py b/appium/webdriver/mobilecommand.py index b0bd8c4d5..966d7e4c1 100644 --- a/appium/webdriver/mobilecommand.py +++ b/appium/webdriver/mobilecommand.py @@ -107,3 +107,7 @@ class MobileCommand: # iOS TOUCH_ID = 'touchId' TOGGLE_TOUCH_ID_ENROLLMENT = 'toggleTouchIdEnrollment' + + # To override selenium commands + GET_LOG = 'getLog' + GET_AVAILABLE_LOG_TYPES = 'getAvailableLogTypes' diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index 8b0233319..cc18d67b1 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -469,3 +469,8 @@ def _addCommands(self) -> None: 'GET', '/session/$sessionId/element/$id/location_in_view', ) + + # override for Appium 1.x + # Appium 2.0 and Appium 1.22 work with `/se/log` and `/se/log/types` + self.command_executor._commands[Command.GET_LOG] = ('POST', '/session/$sessionId/log') + self.command_executor._commands[Command.GET_AVAILABLE_LOG_TYPES] = ('GET', '/session/$sessionId/log/types') diff --git a/test/unit/webdriver/log_test.py b/test/unit/webdriver/log_test.py index 29ba8b663..3c63f657c 100644 --- a/test/unit/webdriver/log_test.py +++ b/test/unit/webdriver/log_test.py @@ -26,7 +26,7 @@ def test_get_log_types(self): driver = ios_w3c_driver() httpretty.register_uri( httpretty.GET, - appium_command('/session/1234567890/se/log/types'), + appium_command('/session/1234567890/log/types'), body=json.dumps({'value': ['syslog']}), ) log_types = driver.log_types @@ -37,7 +37,7 @@ def test_get_log(self): driver = ios_w3c_driver() httpretty.register_uri( httpretty.POST, - appium_command('/session/1234567890/se/log'), + appium_command('/session/1234567890/log'), body=json.dumps({'value': ['logs as array']}), ) log_types = driver.get_log('syslog') From bc48a1311a37272339853480fbb8800399fdf393 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 29 Aug 2021 09:35:18 -0700 Subject: [PATCH 22/49] add types-python-dateutil in 4 branch --- Pipfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Pipfile b/Pipfile index d93a027d6..1d020a711 100644 --- a/Pipfile +++ b/Pipfile @@ -18,6 +18,7 @@ tox = "~=3.23" httpretty = "~=1.0" python-dateutil = "~=2.8" +types-python-dateutil = "~=0.1" mock = "~=4.0" pylint = "~=2.8" From d3055ec914fe709e68a1b075d1b25c8e9f878266 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 14 Jul 2021 00:35:40 -0700 Subject: [PATCH 23/49] feat: Add command with `setattr` (#615) * chore: add placeholder * move to extention way * revert pytest * add todo * call method_name instead of wrapper * remove types * rename a method * add examples * add types-python-dateutil as error message * add example more * tweak naming * Explicit Dict --- README.md | 3 +- appium/webdriver/webdriver.py | 225 +++++++++++++++----------- test/unit/helper/test_helper.py | 34 ++++ test/unit/webdriver/webdriver_test.py | 85 +++++----- 4 files changed, 217 insertions(+), 130 deletions(-) diff --git a/README.md b/README.md index 7555b96cb..fcaa4e58c 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,8 @@ self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, str ## Documentation -https://appium.github.io/python-client-sphinx/ is detailed documentation +- https://appium.github.io/python-client-sphinx/ is detailed documentation +- [functional tests](test/functional) also may help to see concrete examples. ## Development diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index cc18d67b1..26d7e2521 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -15,7 +15,7 @@ # pylint: disable=too-many-lines,too-many-public-methods,too-many-statements,no-self-use import copy -from typing import Any, Dict, List, Optional, TypeVar, Union +from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union from selenium.common.exceptions import InvalidArgumentException from selenium.webdriver.common.by import By @@ -114,6 +114,116 @@ def _make_w3c_caps(caps: Dict) -> Dict[str, List[Dict[str, Any]]]: T = TypeVar('T', bound='WebDriver') +class ExtensionBase: + """ + Used to define an extension command as driver's methods. + + Example: + When you want to add `example_command` which calls a get request to + `session/$sessionId/path/to/your/custom/url`. + + 1. Defines an extension as a subclass of `ExtensionBase` + class YourCustomCommand(ExtensionBase): + def method_name(self): + return 'custom_method_name' + + # Define a method with the name of `method_name` + def custom_method_name(self): + # Generally the response of Appium follows `{ 'value': { data } }` + # format. + return self.execute()['value'] + + # Used to register the command pair as "Appium command" in this driver. + def add_command(self): + return ('GET', 'session/$sessionId/path/to/your/custom/url') + + 2. Creates a session with the extension. + # Appium capabilities + desired_caps = { ... } + driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, + extensions=[YourCustomCommand]) + + 3. Calls the custom command + # Then, the driver calls a get request against + # `session/$sessionId/path/to/your/custom/url`. `$sessionId` will be + # replaced properly in the driver. Then, the method returns + # the `value` part of the response. + driver.custom_method_name() + + 4. Remove added commands (if needed) + # New commands are added by `setattr`. They remain in the module, + # so you should explicitly delete them to define the same name method + # with different arguments or process in the method. + driver.delete_extensions() + + + You can give arbitrary arguments for the command like the below. + + class YourCustomCommand(ExtensionBase): + def method_name(self): + return 'custom_method_name' + + def test_command(self, argument): + return self.execute(argument)['value'] + + def add_command(self): + return ('post', 'session/$sessionId/path/to/your/custom/url') + + driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, + extensions=[YourCustomCommand]) + + # Then, the driver sends a post request to `session/$sessionId/path/to/your/custom/url` + # with `{'dummy_arg': 'as a value'}` JSON body. + driver.custom_method_name({'dummy_arg': 'as a value'}) + + + When you customize the URL dinamically with element id. + + class CustomURLCommand(ExtensionBase): + def method_name(self): + return 'custom_method_name' + + def custom_method_name(self, element_id): + return self.execute({'id': element_id})['value'] + + def add_command(self): + return ('GET', 'session/$sessionId/path/to/your/custom/$id/url') + + driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, + extensions=[YourCustomCommand]) + element = driver.find_element_by_accessibility_id('id') + + # Then, the driver calls a get request to `session/$sessionId/path/to/your/custom/$id/url` + # with replacing the `$id` with the given `element.id` + driver.custom_method_name(element.id) + """ + + def __init__(self, execute: Callable[[str, Dict], Dict[str, Any]]): + self._execute = execute + + def execute(self, parameters: Dict[str, Any] = None) -> Any: + param = {} + if parameters: + param = parameters + return self._execute(self.method_name(), param) + + def method_name(self) -> str: + """ + Expected to return a method name. + This name will be available as a driver method. + + Returns: + 'str' The method name. + """ + raise NotImplementedError() + + def add_command(self) -> Tuple[str, str]: + """ + Expected to define the pair of HTTP method and its URL. + """ + raise NotImplementedError() + + class WebDriver( AppiumSearchContext, ActionHelpers, @@ -150,7 +260,8 @@ def __init__( browser_profile: str = None, proxy: str = None, keep_alive: bool = True, - direct_connection: bool = True, + direct_connection: bool = False, + extensions: List[T] = [], strict_ssl: bool = True, ): @@ -184,6 +295,26 @@ def __init__( By.IMAGE = MobileBy.IMAGE By.CUSTOM = MobileBy.CUSTOM + self._extensions = extensions + for extension in self._extensions: + instance = extension(self.execute) + method_name = instance.method_name() + if hasattr(WebDriver, method_name): + raise ValueError(f'{method_name} is already defined.') + + # add a new method named 'instance.method_name()' and call it + setattr(WebDriver, method_name, getattr(instance, method_name)) + method, url_cmd = instance.add_command() + self.command_executor._commands[method_name] = (method.upper(), url_cmd) # type: ignore + + def delete_extensions(self) -> None: + """Delete extensions added in the class with 'setattr'""" + for extension in self._extensions: + instance = extension(self.execute) + method_name = instance.method_name() + if hasattr(WebDriver, method_name): + delattr(WebDriver, method_name) + def _update_command_executor(self, keep_alive: bool) -> None: """Update command executor following directConnect feature""" direct_protocol = 'directConnectProtocol' @@ -352,96 +483,6 @@ def switch_to(self) -> MobileSwitchTo: return MobileSwitchTo(self) - def add_command(self, method: CommandMethod, url: str, name: str) -> T: - """Add a custom command as 'name' - - Args: - method: The method of HTTP request. Available methods are CommandMethod. - url: The url is URL template as https://www.w3.org/TR/webdriver/#endpoints. - `$sessionId` is a placeholder of current session id. - Other placeholders can be specified with `$` prefix like `$id`. - Then, `{'id': 'some id'}` argument in `execute_custom_command` replaces - the `$id` with the value, `some id`, in the request. - name: The name of a command to call in `execute_custom_command`. - - Returns: - `appium.webdriver.webdriver.WebDriver`: Self instance - - Raises: - ValueError - - Examples: - Define 'test_command' as GET and 'session/$sessionId/path/to/custom/url' - - >>> from appium.webdriver.command_method import CommandMethod - >>> driver.add_command( - method=CommandMethod.GET, - url='session/$sessionId/path/to/custom/url', - name='test_command' - ) - - """ - if name in self.command_executor._commands: - raise ValueError("{} is already defined".format(name)) - - if not isinstance(method, CommandMethod): - raise ValueError( - "'{}' is invalid. Valid method should be one of '{}'.".format(method, CommandMethod.__name__) - ) - - self.command_executor._commands[name] = (method.value, url) - return self - - def execute_custom_command(self, name: str, args: Dict = {}) -> Any: - """Execute a custom command defined as 'name' with args command. - - Args: - name: The name of command defined by `add_command`. - args: The argument as this command body - - Returns: - 'value' JSON object field in the response body. - - Raises: - ValueError, selenium.common.exceptions.WebDriverException - - Examples: - Calls 'test_command' command without arguments. - - >>> from appium.webdriver.command_method import CommandMethod - >>> driver.add_command( - method=CommandMethod.GET, - url='session/$sessionId/path/to/custom/url', - name='test_command' - ) - >>> result = driver.execute_custom_command('test_command') - - Calls 'test_command' command with arguments. - - >>> from appium.webdriver.command_method import CommandMethod - >>> driver.add_command( - method=CommandMethod.POST, - url='session/$sessionId/path/to/custom/url', - name='test_command' - ) - >>> result = driver.execute_custom_command('test_command', {'dummy': 'test argument'}) - - Calls 'test_command' command with arguments, and the path has 'element id'. - The '$id' will be 'element id' by 'id' key in the given argument. - - >>> from appium.webdriver.command_method import CommandMethod - >>> driver.add_command( - method=CommandMethod.POST, - url='session/$sessionId/path/to/$id/url', - name='test_command' - ) - >>> result = driver.execute_custom_command('test_command', {'id': 'element id', 'dummy': 'test argument'}) - - """ - if name not in self.command_executor._commands: - raise ValueError("No {} custom command. Please add it by 'add_command'".format(name)) - return self.execute(name, args)['value'] - # pylint: disable=protected-access def _addCommands(self) -> None: diff --git a/test/unit/helper/test_helper.py b/test/unit/helper/test_helper.py index 44f8fbb96..9766e1b76 100644 --- a/test/unit/helper/test_helper.py +++ b/test/unit/helper/test_helper.py @@ -119,6 +119,40 @@ def ios_w3c_driver() -> 'WebDriver': return driver +def ios_w3c_driver_with_extensions(extensions) -> 'WebDriver': + """Return a W3C driver which is generated by a mock response for iOS + + Returns: + `webdriver.webdriver.WebDriver`: An instance of WebDriver + """ + + response_body_json = json.dumps( + { + 'value': { + 'sessionId': '1234567890', + 'capabilities': { + 'device': 'iphone', + 'browserName': 'UICatalog', + 'sdkVersion': '11.4', + 'CFBundleIdentifier': 'com.example.apple-samplecode.UICatalog', + }, + } + } + ) + + httpretty.register_uri(httpretty.POST, appium_command('/session'), body=response_body_json) + + desired_caps = { + 'platformName': 'iOS', + 'deviceName': 'iPhone Simulator', + 'app': 'path/to/app', + 'automationName': 'XCUITest', + } + + driver = webdriver.Remote(SERVER_URL_BASE, desired_caps, extensions=extensions) + return driver + + def get_httpretty_request_body(request: 'HTTPrettyRequestEmpty') -> Dict[str, Any]: """Returns utf-8 decoded request body""" return json.loads(request.body.decode('utf-8')) diff --git a/test/unit/webdriver/webdriver_test.py b/test/unit/webdriver/webdriver_test.py index d9c1b0969..1299f67b0 100644 --- a/test/unit/webdriver/webdriver_test.py +++ b/test/unit/webdriver/webdriver_test.py @@ -21,8 +21,14 @@ from appium import version as appium_version from appium import webdriver from appium.webdriver.command_method import CommandMethod -from appium.webdriver.webdriver import WebDriver -from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body, ios_w3c_driver +from appium.webdriver.webdriver import ExtensionBase, WebDriver +from test.unit.helper.test_helper import ( + android_w3c_driver, + appium_command, + get_httpretty_request_body, + ios_w3c_driver, + ios_w3c_driver_with_extensions, +) class TestWebDriverWebDriver(object): @@ -253,69 +259,74 @@ def exceptionCallback(request, uri, headers): @httpretty.activate def test_add_command(self): - driver = ios_w3c_driver() + class CustomURLCommand(ExtensionBase): + def method_name(self): + return 'test_command' + + def test_command(self): + return self.execute()['value'] + + def add_command(self): + return ('get', 'session/$sessionId/path/to/custom/url') + + driver = ios_w3c_driver_with_extensions([CustomURLCommand]) httpretty.register_uri( httpretty.GET, appium_command('session/1234567890/path/to/custom/url'), body=json.dumps({'value': {}}), ) - driver.add_command(method=CommandMethod.GET, url='session/$sessionId/path/to/custom/url', name='test_command') - result = driver.execute_custom_command('test_command') + result = driver.test_command() assert result == {} + driver.delete_extensions() @httpretty.activate def test_add_command_body(self): - driver = ios_w3c_driver() + class CustomURLCommand(ExtensionBase): + def method_name(self): + return 'test_command' + + def test_command(self, argument): + return self.execute(argument)['value'] + + def add_command(self): + return ('post', 'session/$sessionId/path/to/custom/url') + + driver = ios_w3c_driver_with_extensions([CustomURLCommand]) httpretty.register_uri( httpretty.POST, appium_command('session/1234567890/path/to/custom/url'), body=json.dumps({'value': {}}), ) - driver.add_command(method=CommandMethod.POST, url='session/$sessionId/path/to/custom/url', name='test_command') - result = driver.execute_custom_command('test_command', {'dummy': 'test argument'}) + result = driver.test_command({'dummy': 'test argument'}) assert result == {} d = get_httpretty_request_body(httpretty.last_request()) + assert d['dummy'] == 'test argument' + driver.delete_extensions() @httpretty.activate def test_add_command_with_element_id(self): - driver = ios_w3c_driver() + class CustomURLCommand(ExtensionBase): + def method_name(self): + return 'test_command' + + def test_command(self, element_id): + return self.execute({'id': element_id})['value'] + + def add_command(self): + return ('GET', 'session/$sessionId/path/to/custom/$id/url') + + driver = ios_w3c_driver_with_extensions([CustomURLCommand]) httpretty.register_uri( httpretty.GET, appium_command('session/1234567890/path/to/custom/element_id/url'), body=json.dumps({'value': {}}), ) - driver.add_command( - method=CommandMethod.GET, url='session/$sessionId/path/to/custom/$id/url', name='test_command' - ) - result = driver.execute_custom_command('test_command', {'id': 'element_id'}) + result = driver.test_command('element_id') assert result == {} - - @httpretty.activate - def test_add_command_already_defined(self): - driver = ios_w3c_driver() - driver.add_command(method=CommandMethod.GET, url='session/$sessionId/path/to/custom/url', name='test_command') - with pytest.raises(ValueError): - driver.add_command( - method=CommandMethod.GET, url='session/$sessionId/path/to/custom/url', name='test_command' - ) - - @httpretty.activate - def test_execute_custom_command(self): - driver = ios_w3c_driver() - driver.add_command(method=CommandMethod.GET, url='session/$sessionId/path/to/custom/url', name='test_command') - with pytest.raises(ValueError): - driver.add_command( - method=CommandMethod.GET, url='session/$sessionId/path/to/custom/url', name='test_command' - ) - - @httpretty.activate - def test_invalid_method(self): - driver = ios_w3c_driver() - with pytest.raises(ValueError): - driver.add_command(method='error', url='session/$sessionId/path/to/custom/url', name='test_command') + driver.delete_extensions() class SubWebDriver(WebDriver): From 4652d865fc032aa193411b5d17f507118de892f1 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 21 Jul 2021 10:11:54 -0700 Subject: [PATCH 24/49] feat: add satellites in set_location (#620) * feat: add satellites in set_location * fix review --- appium/webdriver/extensions/location.py | 4 ++++ test/unit/webdriver/device/location_test.py | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/appium/webdriver/extensions/location.py b/appium/webdriver/extensions/location.py index 780db790a..68d451a61 100644 --- a/appium/webdriver/extensions/location.py +++ b/appium/webdriver/extensions/location.py @@ -43,6 +43,7 @@ def set_location( longitude: Union[float, str], altitude: Union[float, str] = None, speed: Union[float, str] = None, + satellites: Union[float, str] = None, ) -> T: """Set the location of the device @@ -51,6 +52,7 @@ def set_location( longitude: String or numeric value between -180.0 and 180.0 altitude: String or numeric value (Android real device only) speed: String or numeric value larger than 0.0 (Android real devices only) + satellites: String or numeric value of active GPS satellites in range 1..12. (Android emulators only) Returns: Union['WebDriver', 'Location']: Self instance @@ -65,6 +67,8 @@ def set_location( data['location']['altitude'] = altitude if speed is not None: data['location']['speed'] = speed + if satellites is not None: + data['location']['satellites'] = satellites self.execute(Command.SET_LOCATION, data) return self diff --git a/test/unit/webdriver/device/location_test.py b/test/unit/webdriver/device/location_test.py index afbef3329..c351c2f4f 100644 --- a/test/unit/webdriver/device/location_test.py +++ b/test/unit/webdriver/device/location_test.py @@ -33,25 +33,27 @@ def test_toggle_location_services(self): def test_set_location_float(self): driver = android_w3c_driver() httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/location')) - assert isinstance(driver.set_location(11.1, 22.2, 33.3, 23.2), WebDriver) + assert isinstance(driver.set_location(11.1, 22.2, 33.3, 23.2, 12), WebDriver) d = get_httpretty_request_body(httpretty.last_request()) assert abs(d['location']['latitude'] - 11.1) <= FLT_EPSILON assert abs(d['location']['longitude'] - 22.2) <= FLT_EPSILON assert abs(d['location']['altitude'] - 33.3) <= FLT_EPSILON assert abs(d['location']['speed'] - 23.2) <= FLT_EPSILON + assert abs(d['location']['satellites'] - 12) <= FLT_EPSILON @httpretty.activate def test_set_location_str(self): driver = android_w3c_driver() httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/location')) - assert isinstance(driver.set_location('11.1', '22.2', '33.3', '23.2'), WebDriver) + assert isinstance(driver.set_location('11.1', '22.2', '33.3', '23.2', '12'), WebDriver) d = get_httpretty_request_body(httpretty.last_request()) assert d['location']['latitude'] == '11.1' assert d['location']['longitude'] == '22.2' assert d['location']['altitude'] == '33.3' assert d['location']['speed'] == '23.2' + assert d['location']['satellites'] == '12' @httpretty.activate def test_set_location_without_altitude(self): From 097f7a71f12ec8bb71e42dc4dcfa489439fbea04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Jul 2021 10:40:30 -0700 Subject: [PATCH 25/49] chore(deps): update tox requirement from ~=3.23 to ~=3.24 (#619) Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/master/docs/changelog.rst) - [Commits](https://github.com/tox-dev/tox/compare/3.23.0...3.24.0) --- updated-dependencies: - dependency-name: tox dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Pipfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pipfile b/Pipfile index 1d020a711..323f82514 100644 --- a/Pipfile +++ b/Pipfile @@ -14,7 +14,7 @@ black = "==20.8b1" pytest = "~=6.2" pytest-cov = "~=2.12" -tox = "~=3.23" +tox = "~=3.24" httpretty = "~=1.0" python-dateutil = "~=2.8" From b5871a933154f6e7897546be41416f29d8ced850 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 29 Aug 2021 11:50:19 +0900 Subject: [PATCH 26/49] chore(deps): update pylint requirement from ~=2.8 to ~=2.10 (#628) Updates the requirements on [pylint](https://github.com/PyCQA/pylint) to permit the latest version. - [Release notes](https://github.com/PyCQA/pylint/releases) - [Changelog](https://github.com/PyCQA/pylint/blob/main/ChangeLog) - [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.8.0...v2.10.2) --- updated-dependencies: - dependency-name: pylint dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Pipfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pipfile b/Pipfile index 323f82514..6c2adea8d 100644 --- a/Pipfile +++ b/Pipfile @@ -21,7 +21,7 @@ python-dateutil = "~=2.8" types-python-dateutil = "~=0.1" mock = "~=4.0" -pylint = "~=2.8" +pylint = "~=2.10" astroid = "~=2.5" isort = "~=5.8" From 611684df871b2311c2fe7c8ed947030416db233a Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 29 Aug 2021 12:51:17 -0700 Subject: [PATCH 27/49] Bump 2.0.0.b5 --- appium/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/version.py b/appium/version.py index e800ff377..801b0c621 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.b4' +version = '2.0.0.b5' From b922edb61d7da566f23db12b552880b411ae0db8 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 29 Aug 2021 12:51:26 -0700 Subject: [PATCH 28/49] Update changelog for 2.0.0.b5 --- CHANGELOG.rst | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index df7e91be3..a9988553f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,41 @@ Changelog (unreleased) ------------ +New +~~~ +- Feat: add satellites in set_location (#620) [Kazuaki Matsuo] + + * feat: add satellites in set_location + + * fix review +- Feat: Add command with `setattr` (#615) [Kazuaki Matsuo] + + * chore: add placeholder + + * move to extention way + + * revert pytest + + * add todo + + * call method_name instead of wrapper + + * remove types + + * rename a method + + * add examples + + * add types-python-dateutil as error message + + * add example more + + * tweak naming + + * Explicit Dict +- Add types-python-dateutil in 4 branch. [Kazuaki Matsuo] +- Add test to check log path. [Kazuaki Matsuo] + Fix ~~~ - Remove w3c argument in MobileWebElement (#598) [Kazuaki Matsuo] @@ -19,6 +54,36 @@ Fix Other ~~~~~ +- Bump 2.0.0.b5. [Kazuaki Matsuo] +- Chore(deps): update pylint requirement from ~=2.8 to ~=2.10 (#628) + [dependabot[bot]] + + Updates the requirements on [pylint](https://github.com/PyCQA/pylint) to permit the latest version. + - [Release notes](https://github.com/PyCQA/pylint/releases) + - [Changelog](https://github.com/PyCQA/pylint/blob/main/ChangeLog) + - [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.8.0...v2.10.2) + + --- + updated-dependencies: + - dependency-name: pylint + dependency-type: direct:production + ... +- Chore(deps): update tox requirement from ~=3.23 to ~=3.24 (#619) + [dependabot[bot]] + + Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. + - [Release notes](https://github.com/tox-dev/tox/releases) + - [Changelog](https://github.com/tox-dev/tox/blob/master/docs/changelog.rst) + - [Commits](https://github.com/tox-dev/tox/compare/3.23.0...3.24.0) + + --- + updated-dependencies: + - dependency-name: tox + dependency-type: direct:production + ... +- Override log. [Kazuaki Matsuo] +- Bump selenium version in tox. [Kazuaki Matsuo] +- Update changelog for 2.0.0.b4. [Kazuaki Matsuo] - Bump 2.0.0.b4. [Kazuaki Matsuo] - Use python selenium client v4.0.0.b4. [Kazuaki Matsuo] - Update changelog for 2.0.0.b3. [Kazuaki Matsuo] From 21dd533827b2518696c399ac9be5eefc934123ec Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Mon, 30 Aug 2021 00:02:44 -0700 Subject: [PATCH 29/49] feat: do not raise an error in case method is already defined (#632) --- appium/webdriver/webdriver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index 26d7e2521..f6eae6778 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -300,7 +300,7 @@ def __init__( instance = extension(self.execute) method_name = instance.method_name() if hasattr(WebDriver, method_name): - raise ValueError(f'{method_name} is already defined.') + logger.debug(f"Overriding the method '{method_name}'") # add a new method named 'instance.method_name()' and call it setattr(WebDriver, method_name, getattr(instance, method_name)) From b174ce9def0a1b3685b52dcbe421c9cbb1f675c6 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Tue, 7 Sep 2021 17:04:24 -0700 Subject: [PATCH 30/49] try rc1 --- Pipfile | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Pipfile b/Pipfile index 6c2adea8d..9b4a92523 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true pre-commit = "~=2.13" [packages] -selenium = "4.0.0.b4" +selenium = "4.0.0.rc1" black = "==20.8b1" diff --git a/setup.py b/setup.py index 20c7cb8fa..778b3e78e 100644 --- a/setup.py +++ b/setup.py @@ -47,5 +47,5 @@ 'Topic :: Software Development :: Quality Assurance', 'Topic :: Software Development :: Testing', ], - install_requires=['selenium == 4.0.0.b4'], + install_requires=['selenium == 4.0.0.rc1'], ) From bd13a4397a9efbee5173c2c2dbf4176ab170b7c2 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 8 Sep 2021 01:05:27 -0700 Subject: [PATCH 31/49] Bump 2.0.0.rc1 --- appium/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/version.py b/appium/version.py index 801b0c621..876bd7543 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.b5' +version = '2.0.0.rc1' From caf50bd3592050fc60c8cfcaa1806ba392c4b429 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 8 Sep 2021 01:05:36 -0700 Subject: [PATCH 32/49] Update changelog for 2.0.0.rc1 --- CHANGELOG.rst | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a9988553f..89996f30a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,40 @@ Changelog New ~~~ +- Feat: do not raise an error in case method is already defined (#632) + [Kazuaki Matsuo] +- Feat: add satellites in set_location (#620) [Kazuaki Matsuo] + + * feat: add satellites in set_location + + * fix review +- Feat: Add command with `setattr` (#615) [Kazuaki Matsuo] + + * chore: add placeholder + + * move to extention way + + * revert pytest + + * add todo + + * call method_name instead of wrapper + + * remove types + + * rename a method + + * add examples + + * add types-python-dateutil as error message + + * add example more + + * tweak naming + + * Explicit Dict +- Feat: do not raise an error in case method is already defined (#632) + [Kazuaki Matsuo] - Feat: add satellites in set_location (#620) [Kazuaki Matsuo] * feat: add satellites in set_location @@ -54,6 +88,61 @@ Fix Other ~~~~~ +- Bump 2.0.0.rc1. [Kazuaki Matsuo] +- Chore(deps): update mypy requirement from ~=0.812 to ~=0.910 (#616) + [dependabot[bot]] + + Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version. + - [Release notes](https://github.com/python/mypy/releases) + - [Commits](https://github.com/python/mypy/compare/v0.812...v0.910) + + --- + updated-dependencies: + - dependency-name: mypy + dependency-type: direct:production + ... +- Chore(deps): update astroid requirement from ~=2.5 to ~=2.7 (#629) + [dependabot[bot]] + + Updates the requirements on [astroid](https://github.com/PyCQA/astroid) to permit the latest version. + - [Release notes](https://github.com/PyCQA/astroid/releases) + - [Changelog](https://github.com/PyCQA/astroid/blob/main/ChangeLog) + - [Commits](https://github.com/PyCQA/astroid/compare/astroid-2.5...v2.7.2) + + --- + updated-dependencies: + - dependency-name: astroid + dependency-type: direct:production + ... +- Chore(deps): update pylint requirement from ~=2.8 to ~=2.10 (#628) + [dependabot[bot]] + + Updates the requirements on [pylint](https://github.com/PyCQA/pylint) to permit the latest version. + - [Release notes](https://github.com/PyCQA/pylint/releases) + - [Changelog](https://github.com/PyCQA/pylint/blob/main/ChangeLog) + - [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.8.0...v2.10.2) + + --- + updated-dependencies: + - dependency-name: pylint + dependency-type: direct:production + ... +- Chore(deps): update tox requirement from ~=3.23 to ~=3.24 (#619) + [dependabot[bot]] + + Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. + - [Release notes](https://github.com/tox-dev/tox/releases) + - [Changelog](https://github.com/tox-dev/tox/blob/master/docs/changelog.rst) + - [Commits](https://github.com/tox-dev/tox/compare/3.23.0...3.24.0) + + --- + updated-dependencies: + - dependency-name: tox + dependency-type: direct:production + ... +- Update changelog for 1.2.0. [Kazuaki Matsuo] +- Try rc1. [Kazuaki Matsuo] +- Update changelog for 2.0.0.b5. [Kazuaki Matsuo] - Bump 2.0.0.b5. [Kazuaki Matsuo] - Chore(deps): update pylint requirement from ~=2.8 to ~=2.10 (#628) [dependabot[bot]] From 5d95625e74b56a86729c66495f2a506887104300 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 30 Sep 2021 11:34:48 -0700 Subject: [PATCH 33/49] try rc2 --- Pipfile | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Pipfile b/Pipfile index 4678c8e89..63ef86204 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true pre-commit = "~=2.13" [packages] -selenium = "4.0.0.rc1" +selenium = "4.0.0.rc2" black = "==20.8b1" diff --git a/setup.py b/setup.py index 778b3e78e..d67582307 100644 --- a/setup.py +++ b/setup.py @@ -47,5 +47,5 @@ 'Topic :: Software Development :: Quality Assurance', 'Topic :: Software Development :: Testing', ], - install_requires=['selenium == 4.0.0.rc1'], + install_requires=['selenium == 4.0.0.rc2'], ) From 80ed2eb066861597715b34ccd22e2d065949c1e3 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 1 Oct 2021 01:27:59 -0700 Subject: [PATCH 34/49] Bump 2.0.0.rc2 --- appium/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/version.py b/appium/version.py index 876bd7543..bf0416833 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.rc1' +version = '2.0.0.rc2' From 3254b0162bda2a7324dc2a9a65cdd5a01dafd54f Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 1 Oct 2021 01:28:07 -0700 Subject: [PATCH 35/49] Update changelog for 2.0.0.rc2 --- CHANGELOG.rst | 157 +++++++++++++++++++++++++++++++------------------- 1 file changed, 98 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 89996f30a..2789add01 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -39,6 +39,80 @@ New * tweak naming * Explicit Dict +- Add types-python-dateutil in 4 branch. [Kazuaki Matsuo] +- Add test to check log path. [Kazuaki Matsuo] + +Fix +~~~ +- Remove w3c argument in MobileWebElement (#598) [Kazuaki Matsuo] + + * Bump 2.0.0.b1 + + * Update changelog for 2.0.0.b1 + + * remove w3c +- Fix format with black. [Kazuaki Matsuo] +- Fix lint, CI and tests. [Kazuaki Matsuo] + +Other +~~~~~ +- Bump 2.0.0.rc2. [Kazuaki Matsuo] +- Try rc2. [Kazuaki Matsuo] +- Update changelog for 2.0.0.rc1. [Kazuaki Matsuo] +- Bump 2.0.0.rc1. [Kazuaki Matsuo] +- Try rc1. [Kazuaki Matsuo] +- Update changelog for 2.0.0.b5. [Kazuaki Matsuo] +- Bump 2.0.0.b5. [Kazuaki Matsuo] +- Chore(deps): update pylint requirement from ~=2.8 to ~=2.10 (#628) + [dependabot[bot]] + + Updates the requirements on [pylint](https://github.com/PyCQA/pylint) to permit the latest version. + - [Release notes](https://github.com/PyCQA/pylint/releases) + - [Changelog](https://github.com/PyCQA/pylint/blob/main/ChangeLog) + - [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.8.0...v2.10.2) + + --- + updated-dependencies: + - dependency-name: pylint + dependency-type: direct:production + ... +- Chore(deps): update tox requirement from ~=3.23 to ~=3.24 (#619) + [dependabot[bot]] + + Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. + - [Release notes](https://github.com/tox-dev/tox/releases) + - [Changelog](https://github.com/tox-dev/tox/blob/master/docs/changelog.rst) + - [Commits](https://github.com/tox-dev/tox/compare/3.23.0...3.24.0) + + --- + updated-dependencies: + - dependency-name: tox + dependency-type: direct:production + ... +- Override log. [Kazuaki Matsuo] +- Bump selenium version in tox. [Kazuaki Matsuo] +- Update changelog for 2.0.0.b4. [Kazuaki Matsuo] +- Bump 2.0.0.b4. [Kazuaki Matsuo] +- Use python selenium client v4.0.0.b4. [Kazuaki Matsuo] +- Update changelog for 2.0.0.b3. [Kazuaki Matsuo] +- Bump 2.0.0.b3. [Kazuaki Matsuo] +- Tweak some lines. [Kazuaki Matsuo] +- Update selenium in pipfile. [Kazuaki Matsuo] +- Bump selenium 4.0.0.b3. [Kazuaki Matsuo] +- Update pipfile. [Kazuaki Matsuo] +- Update changelog for 2.0.0.b2. [Kazuaki Matsuo] +- Bump 2.0.0.b2. [Kazuaki Matsuo] +- Bump base selenium version to 4.0.0.b2. [Kazuaki Matsuo] +- Bump v2.0.0.a0. [Kazuaki Matsuo] +- Update changelog for v2.0.0.a0. [Kazuaki Matsuo] +- Bump selenium. [Kazuaki Matsuo] + + +v1.3.0 (2021-09-27) +------------------- + +New +~~~ - Feat: do not raise an error in case method is already defined (#632) [Kazuaki Matsuo] - Feat: add satellites in set_location (#620) [Kazuaki Matsuo] @@ -71,24 +145,35 @@ New * tweak naming * Explicit Dict -- Add types-python-dateutil in 4 branch. [Kazuaki Matsuo] -- Add test to check log path. [Kazuaki Matsuo] -Fix -~~~ -- Remove w3c argument in MobileWebElement (#598) [Kazuaki Matsuo] +Other +~~~~~ +- Bump 1.3.0. [Kazuaki Matsuo] +- Chore(deps): update types-python-dateutil requirement (#633) + [dependabot[bot]] - * Bump 2.0.0.b1 + Updates the requirements on [types-python-dateutil](https://github.com/python/typeshed) to permit the latest version. + - [Release notes](https://github.com/python/typeshed/releases) + - [Commits](https://github.com/python/typeshed/commits) - * Update changelog for 2.0.0.b1 + --- + updated-dependencies: + - dependency-name: types-python-dateutil + dependency-type: direct:production + ... +- Chore(deps-dev): update pre-commit requirement from ~=2.13 to ~=2.15 + (#634) [dependabot[bot]] - * remove w3c -- Fix format with black. [Kazuaki Matsuo] -- Fix lint, CI and tests. [Kazuaki Matsuo] + Updates the requirements on [pre-commit](https://github.com/pre-commit/pre-commit) to permit the latest version. + - [Release notes](https://github.com/pre-commit/pre-commit/releases) + - [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md) + - [Commits](https://github.com/pre-commit/pre-commit/compare/v2.13.0...v2.15.0) -Other -~~~~~ -- Bump 2.0.0.rc1. [Kazuaki Matsuo] + --- + updated-dependencies: + - dependency-name: pre-commit + dependency-type: direct:development + ... - Chore(deps): update mypy requirement from ~=0.812 to ~=0.910 (#616) [dependabot[bot]] @@ -141,52 +226,6 @@ Other dependency-type: direct:production ... - Update changelog for 1.2.0. [Kazuaki Matsuo] -- Try rc1. [Kazuaki Matsuo] -- Update changelog for 2.0.0.b5. [Kazuaki Matsuo] -- Bump 2.0.0.b5. [Kazuaki Matsuo] -- Chore(deps): update pylint requirement from ~=2.8 to ~=2.10 (#628) - [dependabot[bot]] - - Updates the requirements on [pylint](https://github.com/PyCQA/pylint) to permit the latest version. - - [Release notes](https://github.com/PyCQA/pylint/releases) - - [Changelog](https://github.com/PyCQA/pylint/blob/main/ChangeLog) - - [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.8.0...v2.10.2) - - --- - updated-dependencies: - - dependency-name: pylint - dependency-type: direct:production - ... -- Chore(deps): update tox requirement from ~=3.23 to ~=3.24 (#619) - [dependabot[bot]] - - Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. - - [Release notes](https://github.com/tox-dev/tox/releases) - - [Changelog](https://github.com/tox-dev/tox/blob/master/docs/changelog.rst) - - [Commits](https://github.com/tox-dev/tox/compare/3.23.0...3.24.0) - - --- - updated-dependencies: - - dependency-name: tox - dependency-type: direct:production - ... -- Override log. [Kazuaki Matsuo] -- Bump selenium version in tox. [Kazuaki Matsuo] -- Update changelog for 2.0.0.b4. [Kazuaki Matsuo] -- Bump 2.0.0.b4. [Kazuaki Matsuo] -- Use python selenium client v4.0.0.b4. [Kazuaki Matsuo] -- Update changelog for 2.0.0.b3. [Kazuaki Matsuo] -- Bump 2.0.0.b3. [Kazuaki Matsuo] -- Tweak some lines. [Kazuaki Matsuo] -- Update selenium in pipfile. [Kazuaki Matsuo] -- Bump selenium 4.0.0.b3. [Kazuaki Matsuo] -- Update pipfile. [Kazuaki Matsuo] -- Update changelog for 2.0.0.b2. [Kazuaki Matsuo] -- Bump 2.0.0.b2. [Kazuaki Matsuo] -- Bump base selenium version to 4.0.0.b2. [Kazuaki Matsuo] -- Bump v2.0.0.a0. [Kazuaki Matsuo] -- Update changelog for v2.0.0.a0. [Kazuaki Matsuo] -- Bump selenium. [Kazuaki Matsuo] v1.2.0 (2021-06-07) From db32d1bbaf70a4b655c35cc0b26975b48c70bd2d Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 9 Oct 2021 22:32:35 -0700 Subject: [PATCH 36/49] use 4.0.0.rc3 --- Pipfile | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Pipfile b/Pipfile index 63ef86204..64d88a934 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true pre-commit = "~=2.13" [packages] -selenium = "4.0.0.rc2" +selenium = "4.0.0.rc3" black = "==20.8b1" diff --git a/setup.py b/setup.py index d67582307..c2614d341 100644 --- a/setup.py +++ b/setup.py @@ -47,5 +47,5 @@ 'Topic :: Software Development :: Quality Assurance', 'Topic :: Software Development :: Testing', ], - install_requires=['selenium == 4.0.0.rc2'], + install_requires=['selenium == 4.0.0.rc3'], ) From 145c9b7d8e2235811e9cbb887a4d0e5b1502ae0d Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 10 Oct 2021 01:46:11 -0700 Subject: [PATCH 37/49] Bump 2.0.0.rc3 --- appium/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/version.py b/appium/version.py index bf0416833..f8ce62aba 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.rc2' +version = '2.0.0.rc3' From 0dc09f316040f7951af6c9ab0c034a270ee540e1 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 10 Oct 2021 01:46:17 -0700 Subject: [PATCH 38/49] Update changelog for 2.0.0.rc3 --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2789add01..9ff5aa996 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -56,6 +56,9 @@ Fix Other ~~~~~ +- Bump 2.0.0.rc3. [Kazuaki Matsuo] +- Use 4.0.0.rc3. [Kazuaki Matsuo] +- Update changelog for 2.0.0.rc2. [Kazuaki Matsuo] - Bump 2.0.0.rc2. [Kazuaki Matsuo] - Try rc2. [Kazuaki Matsuo] - Update changelog for 2.0.0.rc1. [Kazuaki Matsuo] From a1e756e32c8c7790a2d83ce73fc4d260144e8a2c Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 13 Oct 2021 11:08:30 -0700 Subject: [PATCH 39/49] bump selenium version --- Pipfile | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Pipfile b/Pipfile index 64d88a934..b185afbb8 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true pre-commit = "~=2.13" [packages] -selenium = "4.0.0.rc3" +selenium = "~=4.0.0" black = "==20.8b1" diff --git a/setup.py b/setup.py index c2614d341..7eb4e8bc2 100644 --- a/setup.py +++ b/setup.py @@ -47,5 +47,5 @@ 'Topic :: Software Development :: Quality Assurance', 'Topic :: Software Development :: Testing', ], - install_requires=['selenium == 4.0.0.rc3'], + install_requires=['selenium ~= 4.0.0'], ) From 033f839d882c1e1b72c1b7b196d3eb5d17725772 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 13 Oct 2021 11:49:11 -0700 Subject: [PATCH 40/49] remove w3c=True from MobileWebElement argument --- test/unit/webdriver/search_context/android_test.py | 6 +++--- test/unit/webdriver/search_context/windows_test.py | 2 +- test/unit/webdriver/webelement_test.py | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/unit/webdriver/search_context/android_test.py b/test/unit/webdriver/search_context/android_test.py index badee09f6..94aefe081 100644 --- a/test/unit/webdriver/search_context/android_test.py +++ b/test/unit/webdriver/search_context/android_test.py @@ -73,7 +73,7 @@ def test_find_elements_by_android_data_matcher_no_value(self): @httpretty.activate def test_find_element_by_android_data_matcher(self): driver = android_w3c_driver() - element = MobileWebElement(driver, 'element_id', w3c=True) + element = MobileWebElement(driver, 'element_id') httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/element/element_id/element'), @@ -94,7 +94,7 @@ def test_find_element_by_android_data_matcher(self): @httpretty.activate def test_find_elements_by_android_data_matcher(self): driver = android_w3c_driver() - element = MobileWebElement(driver, 'element_id', w3c=True) + element = MobileWebElement(driver, 'element_id') httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/element/element_id/elements'), @@ -113,7 +113,7 @@ def test_find_elements_by_android_data_matcher(self): @httpretty.activate def test_find_elements_by_android_data_matcher_no_value(self): driver = android_w3c_driver() - element = MobileWebElement(driver, 'element_id', w3c=True) + element = MobileWebElement(driver, 'element_id') httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/element/element_id/elements'), body='{"value": []}' ) diff --git a/test/unit/webdriver/search_context/windows_test.py b/test/unit/webdriver/search_context/windows_test.py index 5e0b3c4a6..99296df18 100644 --- a/test/unit/webdriver/search_context/windows_test.py +++ b/test/unit/webdriver/search_context/windows_test.py @@ -22,7 +22,7 @@ class TestWebDriverWindowsSearchContext(object): @httpretty.activate def test_find_element_by_windows_uiautomation(self): driver = android_w3c_driver() - element = MobileWebElement(driver, 'element_id', w3c=True) + element = MobileWebElement(driver, 'element_id') httpretty.register_uri( httpretty.POST, appium_command('/session/1234567890/element/element_id/element'), diff --git a/test/unit/webdriver/webelement_test.py b/test/unit/webdriver/webelement_test.py index f9b38922a..59464fd89 100644 --- a/test/unit/webdriver/webelement_test.py +++ b/test/unit/webdriver/webelement_test.py @@ -28,7 +28,7 @@ def test_set_value(self): driver = android_w3c_driver() httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/appium/element/element_id/value')) - element = MobileWebElement(driver, 'element_id', w3c=True) + element = MobileWebElement(driver, 'element_id') value = 'happy testing' element.set_value(value) @@ -40,7 +40,7 @@ def test_send_key(self): driver = android_w3c_driver() httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/element/element_id/value')) - element = MobileWebElement(driver, 'element_id', w3c=True) + element = MobileWebElement(driver, 'element_id') element.send_keys('happy testing') d = get_httpretty_request_body(httpretty.last_request()) @@ -54,7 +54,7 @@ def test_send_key_with_file(self): httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/element/element_id/value')) try: - element = MobileWebElement(driver, 'element_id', w3c=True) + element = MobileWebElement(driver, 'element_id') element.send_keys(tmp_f.name) finally: tmp_f.close() @@ -72,7 +72,7 @@ def test_get_attribute_with_dict(self): body=json.dumps({"value": rect_dict}), ) - element = MobileWebElement(driver, 'element_id', w3c=True) + element = MobileWebElement(driver, 'element_id') ef = element.get_attribute('rect') d = httpretty.last_request() From 7fcf9b177207d6d63e60870261214d3635a292ba Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 13 Oct 2021 13:09:05 -0700 Subject: [PATCH 41/49] remove w3c flag --- appium/webdriver/extensions/action_helpers.py | 2 +- appium/webdriver/webdriver.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/appium/webdriver/extensions/action_helpers.py b/appium/webdriver/extensions/action_helpers.py index 0a0fc4c25..dcb38e6d2 100644 --- a/appium/webdriver/extensions/action_helpers.py +++ b/appium/webdriver/extensions/action_helpers.py @@ -45,7 +45,7 @@ def scroll(self: T, origin_el: WebElement, destination_el: WebElement, duration: """ # XCUITest x W3C spec has no duration by default in server side - if self.w3c and duration is None: + if duration is None: duration = 600 action = TouchAction(self) diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index f6eae6778..b5590c7d2 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -375,8 +375,7 @@ def start_session(self, capabilities: Dict, browser_profile: Optional[str] = Non self.caps = response.get('capabilities') # Double check to see if we have a W3C Compliant browser - self.w3c = response.get('status') is None - self.command_executor.w3c = self.w3c + self.command_executor.w3c = True def _merge_capabilities(self, capabilities: Dict) -> Dict[str, Any]: """Manage capabilities whether W3C format or MJSONWP format""" From ef328e8d5072913d3e363cd40837ad87d2429ff7 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 13 Oct 2021 15:02:27 -0700 Subject: [PATCH 42/49] fix tests --- appium/webdriver/webdriver.py | 1 - test/unit/webdriver/webdriver_test.py | 34 --------------------------- 2 files changed, 35 deletions(-) diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index b5590c7d2..3be8502c0 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -78,7 +78,6 @@ _OSS_W3C_CONVERSION = {'acceptSslCerts': 'acceptInsecureCerts', 'version': 'browserVersion', 'platform': 'platformName'} _EXTENSION_CAPABILITY = ':' -_FORCE_MJSONWP = 'forceMjsonwp' # override # Add appium prefix for the non-W3C capabilities diff --git a/test/unit/webdriver/webdriver_test.py b/test/unit/webdriver/webdriver_test.py index 1299f67b0..db0281a10 100644 --- a/test/unit/webdriver/webdriver_test.py +++ b/test/unit/webdriver/webdriver_test.py @@ -61,42 +61,8 @@ def test_create_session(self): assert request_json.get('desiredCapabilities') is not None assert driver.session_id == 'session-id' - assert driver.w3c assert driver.command_executor.w3c - @httpretty.activate - def test_create_session_forceMjsonwp(self): - httpretty.register_uri( - httpretty.POST, - 'http://localhost:4723/wd/hub/session', - body='{ "capabilities": {"deviceName": "Android Emulator"}, "status": 0, "sessionId": "session-id"}', - ) - - desired_caps = { - 'platformName': 'Android', - 'deviceName': 'Android Emulator', - 'app': 'path/to/app', - 'automationName': 'UIAutomator2', - 'forceMjsonwp': True, - } - driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) - - # This tests counts the same request twice on Azure only for now (around 20th May, 2021). Local running works. - # Should investigate the cause. - # assert len(httpretty.HTTPretty.latest_requests) == 1 - - request = httpretty.HTTPretty.latest_requests[0] - assert request.headers['content-type'] == 'application/json;charset=UTF-8' - assert 'appium/python {} (selenium'.format(appium_version.version) in request.headers['user-agent'] - - request_json = json.loads(httpretty.HTTPretty.latest_requests[0].body.decode('utf-8')) - assert request_json.get('capabilities') is not None - assert request_json.get('desiredCapabilities') is not None - - assert driver.session_id == 'session-id' - assert driver.w3c is False - assert driver.command_executor.w3c is False - @httpretty.activate def test_create_session_change_session_id(self): httpretty.register_uri( From 50664238fed54ac01f53c90f0d6e769b7f2de084 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 14 Oct 2021 00:45:24 -0700 Subject: [PATCH 43/49] tweak tests --- test/functional/ios/safari_tests.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/functional/ios/safari_tests.py b/test/functional/ios/safari_tests.py index 121edaca4..a62cf2852 100644 --- a/test/functional/ios/safari_tests.py +++ b/test/functional/ios/safari_tests.py @@ -38,10 +38,7 @@ def test_get(self) -> None: self.driver.get("http://google.com") for _ in range(5): time.sleep(0.5) - try: - assert 'Google' == self.driver.title + if 'Google' == self.driver.title: return - except Exception: - pass assert False, 'The title was wrong' From 9c0f60b1ce44856d319c3fce3d5e93de9b5d4f36 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 14 Oct 2021 00:55:20 -0700 Subject: [PATCH 44/49] Bump 2.0.0.rc4 --- appium/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium/version.py b/appium/version.py index f8ce62aba..9dd833aa4 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1 @@ -version = '2.0.0.rc3' +version = '2.0.0.rc4' From c7b48fb2d7ac9abb76522409303c393ed728760b Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 14 Oct 2021 00:55:27 -0700 Subject: [PATCH 45/49] Update changelog for 2.0.0.rc4 --- CHANGELOG.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9ff5aa996..db6516a60 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -44,6 +44,7 @@ New Fix ~~~ +- Fix tests. [Kazuaki Matsuo] - Remove w3c argument in MobileWebElement (#598) [Kazuaki Matsuo] * Bump 2.0.0.b1 @@ -56,6 +57,12 @@ Fix Other ~~~~~ +- Bump 2.0.0.rc4. [Kazuaki Matsuo] +- Tweak tests. [Kazuaki Matsuo] +- Remove w3c flag. [Kazuaki Matsuo] +- Remove w3c=True from MobileWebElement argument. [Kazuaki Matsuo] +- Bump selenium version. [Kazuaki Matsuo] +- Update changelog for 2.0.0.rc3. [Kazuaki Matsuo] - Bump 2.0.0.rc3. [Kazuaki Matsuo] - Use 4.0.0.rc3. [Kazuaki Matsuo] - Update changelog for 2.0.0.rc2. [Kazuaki Matsuo] From c3597272357c26a4e1653e8be1c8222cc9dc45fb Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 14 Oct 2021 19:36:07 -0700 Subject: [PATCH 46/49] cleanup readme --- README.md | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index fcaa4e58c..713e9cd70 100644 --- a/README.md +++ b/README.md @@ -7,20 +7,15 @@ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -An extension library for adding [Selenium 3.0 draft](https://dvcs.w3.org/hg/webdriver/raw-file/tip/webdriver-spec.html) and [Mobile JSON Wire Protocol Specification draft](https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md) -functionality to the Python language bindings, for use with the mobile testing -framework [Appium](https://appium.io). +An extension library for adding [WebDriver Protocol](https://www.w3.org/TR/webdriver/) and Appium commands to the Selenium Python language binding for use with the mobile testing framework [Appium](https://appium.io). ## Notice -Since **v1.0.0**, only Python 3 is supported +Since **v1.0.0**, only Python 3 is supported. -### developing version -[selenium-4](https://github.com/appium/python-client/tree/selenium-4) branch is a developing branch to switch base selenium client version from v3 to v4. The branch is available as pre-release versioning like `2.0.0.a0` via pypi. - -Main differences since current v1 is the v2 can connect to invalid SSL environment like self-certificated server. Please take a look at the branch's README for more details. - -Please install lower version of `trio` like `pip install trio==0.17.0` if your environment failed to install `trio` dependency. +Since **v2.0.0**, base selenium client version is v4. +The version only works W3C WebDriver protocol format. +If you would like to use old protocol (MJSONWP), please use v1 Appium Python cleint. ## Getting the Appium Python client @@ -54,12 +49,8 @@ download and unarchive the source tarball (Appium-Python-Client-X.X.tar.gz). ## Usage -The Appium Python Client is fully compliant with the Selenium 3.0 specification -draft, with some helpers to make mobile testing in Python easier. The majority of -the usage remains as it has been for Selenium 2 (WebDriver), and as the [official -Selenium Python bindings](https://pypi.org/project/selenium/) begins to -implement the new specification that implementation will be used underneath, so -test code can be written that is utilizable with both bindings. +The Appium Python Client is fully compliant with the WebDriver Protocol +with some helpers to make mobile testing in Python easier. To use the new functionality now, and to use the superset of functions, instead of including the Selenium `webdriver` module in your test code, use that from From dbb928818bed3ac34d32c55fe460834dc47f510e Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 15 Oct 2021 00:02:33 -0700 Subject: [PATCH 47/49] fix readme --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 713e9cd70..fbfa9e869 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ An extension library for adding [WebDriver Protocol](https://www.w3.org/TR/webdr ## Notice -Since **v1.0.0**, only Python 3 is supported. +Since **v1.0.0**, only Python 3.7+ is supported. -Since **v2.0.0**, base selenium client version is v4. -The version only works W3C WebDriver protocol format. -If you would like to use old protocol (MJSONWP), please use v1 Appium Python cleint. +Since **v2.0.0**, the base selenium client version is v4. +The version only works in W3C WebDriver protocol format. +If you would like to use the old protocol (MJSONWP), please use v1 Appium Python client. ## Getting the Appium Python client @@ -50,7 +50,7 @@ download and unarchive the source tarball (Appium-Python-Client-X.X.tar.gz). ## Usage The Appium Python Client is fully compliant with the WebDriver Protocol -with some helpers to make mobile testing in Python easier. +including several helpers to make mobile testing in Python easier. To use the new functionality now, and to use the superset of functions, instead of including the Selenium `webdriver` module in your test code, use that from @@ -128,7 +128,7 @@ self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, dir ## Relax SSL validation -`strict_ssl` option allows you to send commands to an invalid certificate host like self-certificated SSL. +`strict_ssl` option allows you to send commands to an invalid certificate host like a self-signed one. ```python import unittest From acbffa5ddf7515b1b67320940794fd916d3204db Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 15 Oct 2021 00:04:20 -0700 Subject: [PATCH 48/49] tweak indentations --- appium/webdriver/webdriver.py | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index 3be8502c0..ab5998ae5 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -394,17 +394,17 @@ def find_element(self, by: str = By.ID, value: Union[str, Dict] = None) -> Mobil """ # TODO: If we need, we should enable below converter for Web context - # if by == By.ID: - # by = By.CSS_SELECTOR - # value = '[id="%s"]' % value - # elif by == By.TAG_NAME: - # by = By.CSS_SELECTOR - # elif by == By.CLASS_NAME: - # by = By.CSS_SELECTOR - # value = ".%s" % value - # elif by == By.NAME: - # by = By.CSS_SELECTOR - # value = '[name="%s"]' % value + # if by == By.ID: + # by = By.CSS_SELECTOR + # value = '[id="%s"]' % value + # elif by == By.TAG_NAME: + # by = By.CSS_SELECTOR + # elif by == By.CLASS_NAME: + # by = By.CSS_SELECTOR + # value = ".%s" % value + # elif by == By.NAME: + # by = By.CSS_SELECTOR + # value = '[name="%s"]' % value return self.execute(RemoteCommand.FIND_ELEMENT, {'using': by, 'value': value})['value'] @@ -420,17 +420,17 @@ def find_elements(self, by: str = By.ID, value: Union[str, Dict] = None) -> Unio :obj:`list` of :obj:`appium.webdriver.webelement.WebElement`: The found elements """ # TODO: If we need, we should enable below converter for Web context - # if by == By.ID: - # by = By.CSS_SELECTOR - # value = '[id="%s"]' % value - # elif by == By.TAG_NAME: - # by = By.CSS_SELECTOR - # elif by == By.CLASS_NAME: - # by = By.CSS_SELECTOR - # value = ".%s" % value - # elif by == By.NAME: - # by = By.CSS_SELECTOR - # value = '[name="%s"]' % value + # if by == By.ID: + # by = By.CSS_SELECTOR + # value = '[id="%s"]' % value + # elif by == By.TAG_NAME: + # by = By.CSS_SELECTOR + # elif by == By.CLASS_NAME: + # by = By.CSS_SELECTOR + # value = ".%s" % value + # elif by == By.NAME: + # by = By.CSS_SELECTOR + # value = '[name="%s"]' % value # Return empty list if driver returns null # See https://github.com/SeleniumHQ/selenium/issues/4555 From 195c8221f4ca1ea8f2e5c9556edc67f38bc539de Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 15 Oct 2021 00:04:50 -0700 Subject: [PATCH 49/49] let me comment out trio once --- ci-jobs/functional/run_appium.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-jobs/functional/run_appium.yml b/ci-jobs/functional/run_appium.yml index 608621b34..a866957c4 100644 --- a/ci-jobs/functional/run_appium.yml +++ b/ci-jobs/functional/run_appium.yml @@ -13,8 +13,8 @@ steps: versionSpec: '3.x' - script: brew install ffmpeg displayName: Resolve dependencies (Appium server) -- script: pip install trio==0.17.0 - displayName: Install trio +# - script: pip install trio==0.17.0 +# displayName: Install trio - script: python setup.py install displayName: Install python language bindings for Appium - script: |