Appium-Python-Client 5.2.2__py3-none-any.whl → 5.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- appium/webdriver/extensions/images_comparison.py +25 -7
- {appium_python_client-5.2.2.dist-info → appium_python_client-5.2.3.dist-info}/METADATA +1 -1
- {appium_python_client-5.2.2.dist-info → appium_python_client-5.2.3.dist-info}/RECORD +5 -5
- {appium_python_client-5.2.2.dist-info → appium_python_client-5.2.3.dist-info}/WHEEL +0 -0
- {appium_python_client-5.2.2.dist-info → appium_python_client-5.2.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -18,9 +18,11 @@ from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
|
|
|
18
18
|
|
|
19
19
|
from ..mobilecommand import MobileCommand as Command
|
|
20
20
|
|
|
21
|
+
Base64Payload = Union[str, bytes]
|
|
22
|
+
|
|
21
23
|
|
|
22
24
|
class ImagesComparison(CanExecuteCommands):
|
|
23
|
-
def match_images_features(self, base64_image1:
|
|
25
|
+
def match_images_features(self, base64_image1: Base64Payload, base64_image2: Base64Payload, **opts: Any) -> Dict[str, Any]:
|
|
24
26
|
"""Performs images matching by features.
|
|
25
27
|
|
|
26
28
|
Read
|
|
@@ -66,11 +68,16 @@ class ImagesComparison(CanExecuteCommands):
|
|
|
66
68
|
rect2 (dict): The bounding rect for the `points2` array or a zero rect if not enough matching points
|
|
67
69
|
were found. The rect is represented by a dictionary with 'x', 'y', 'width' and 'height' keys
|
|
68
70
|
"""
|
|
69
|
-
options = {
|
|
71
|
+
options = {
|
|
72
|
+
'mode': 'matchFeatures',
|
|
73
|
+
'firstImage': _adjust_image_payload(base64_image1),
|
|
74
|
+
'secondImage': _adjust_image_payload(base64_image2),
|
|
75
|
+
'options': opts,
|
|
76
|
+
}
|
|
70
77
|
return self.execute(Command.COMPARE_IMAGES, options)['value']
|
|
71
78
|
|
|
72
79
|
def find_image_occurrence(
|
|
73
|
-
self, base64_full_image:
|
|
80
|
+
self, base64_full_image: Base64Payload, base64_partial_image: Base64Payload, **opts: Any
|
|
74
81
|
) -> Dict[str, Union[bytes, Dict]]:
|
|
75
82
|
"""Performs images matching by template to find possible occurrence of the partial image
|
|
76
83
|
in the full image.
|
|
@@ -97,13 +104,15 @@ class ImagesComparison(CanExecuteCommands):
|
|
|
97
104
|
"""
|
|
98
105
|
options = {
|
|
99
106
|
'mode': 'matchTemplate',
|
|
100
|
-
'firstImage': base64_full_image,
|
|
101
|
-
'secondImage': base64_partial_image,
|
|
107
|
+
'firstImage': _adjust_image_payload(base64_full_image),
|
|
108
|
+
'secondImage': _adjust_image_payload(base64_partial_image),
|
|
102
109
|
'options': opts,
|
|
103
110
|
}
|
|
104
111
|
return self.execute(Command.COMPARE_IMAGES, options)['value']
|
|
105
112
|
|
|
106
|
-
def get_images_similarity(
|
|
113
|
+
def get_images_similarity(
|
|
114
|
+
self, base64_image1: Base64Payload, base64_image2: Base64Payload, **opts: Any
|
|
115
|
+
) -> Dict[str, Union[bytes, Dict]]:
|
|
107
116
|
"""Performs images matching to calculate the similarity score between them.
|
|
108
117
|
|
|
109
118
|
The flow there is similar to the one used in
|
|
@@ -125,8 +134,17 @@ class ImagesComparison(CanExecuteCommands):
|
|
|
125
134
|
score (float): The similarity score as a float number in range [0.0, 1.0].
|
|
126
135
|
1.0 is the highest score (means both images are totally equal).
|
|
127
136
|
"""
|
|
128
|
-
options = {
|
|
137
|
+
options = {
|
|
138
|
+
'mode': 'getSimilarity',
|
|
139
|
+
'firstImage': _adjust_image_payload(base64_image1),
|
|
140
|
+
'secondImage': _adjust_image_payload(base64_image2),
|
|
141
|
+
'options': opts,
|
|
142
|
+
}
|
|
129
143
|
return self.execute(Command.COMPARE_IMAGES, options)['value']
|
|
130
144
|
|
|
131
145
|
def _add_commands(self) -> None:
|
|
132
146
|
self.command_executor.add_command(Command.COMPARE_IMAGES, 'POST', '/session/$sessionId/appium/compare_images')
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _adjust_image_payload(payload: Base64Payload) -> str:
|
|
150
|
+
return payload if isinstance(payload, str) else payload.decode('utf-8')
|
|
@@ -294,7 +294,7 @@ appium/webdriver/extensions/device_time.py,sha256=gYozvXnUr3pwguf7RZ33W1a_fuK3HB
|
|
|
294
294
|
appium/webdriver/extensions/execute_driver.py,sha256=nzjQq4SxNWJTgan2McyF4eXBB4SzZXhvJ9l1XAnfq84,2615
|
|
295
295
|
appium/webdriver/extensions/execute_mobile_command.py,sha256=XDrmFgv1-DJYtsNRrUW15VAiOgJlGfbL7Sh-ySOnQ_U,2364
|
|
296
296
|
appium/webdriver/extensions/hw_actions.py,sha256=IpJ9c4fEgsxq8wKOhOb6YIq08YtSmE8lUSi9MW6ciwA,5930
|
|
297
|
-
appium/webdriver/extensions/images_comparison.py,sha256=
|
|
297
|
+
appium/webdriver/extensions/images_comparison.py,sha256=ug2lHqJKABl5R12iPtIu-xFMlhlAHVMbiaLGNjZgQgE,7533
|
|
298
298
|
appium/webdriver/extensions/keyboard.py,sha256=b8BNbG0MDlnmRX8ITXSo2kglD0JS07zIqjafJ_25Xy8,6495
|
|
299
299
|
appium/webdriver/extensions/location.py,sha256=1IJbYlTuiQ2yi4O6btEq4uRbmRswnTeEFpYQ_XFWDeg,3608
|
|
300
300
|
appium/webdriver/extensions/log_event.py,sha256=XG4wCgF2BbIiqrmv5QD9waoXsz-Apq_r1NUSXvcj-XE,2472
|
|
@@ -318,7 +318,7 @@ appium/webdriver/extensions/flutter_integration/__init__.py,sha256=wSUl6yC2TJNla
|
|
|
318
318
|
appium/webdriver/extensions/flutter_integration/flutter_commands.py,sha256=zKWaVM-Vaqz-FxItSeYI7YXvld5DPrKhrXyrYPbRbFw,12125
|
|
319
319
|
appium/webdriver/extensions/flutter_integration/flutter_finder.py,sha256=P4rQpiye73aRBq5VOSt1vBD7rTDHrEv0052B1u81_YY,2184
|
|
320
320
|
appium/webdriver/extensions/flutter_integration/scroll_directions.py,sha256=CkOv7k21SMe-h2-EYSZ6MBKBGTRC1csQ-tuowHgMn0E,85
|
|
321
|
-
appium_python_client-5.2.
|
|
322
|
-
appium_python_client-5.2.
|
|
323
|
-
appium_python_client-5.2.
|
|
324
|
-
appium_python_client-5.2.
|
|
321
|
+
appium_python_client-5.2.3.dist-info/METADATA,sha256=W8tpr12w1seuNgy0X3sxVfvzMQx7GTWpeY0Wqomrv-w,20823
|
|
322
|
+
appium_python_client-5.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
323
|
+
appium_python_client-5.2.3.dist-info/licenses/LICENSE,sha256=QxeKfXNmPWCfFyrXiwdVzMFPFMK0nlBrKhYLUoIcqhk,11384
|
|
324
|
+
appium_python_client-5.2.3.dist-info/RECORD,,
|
|
File without changes
|
{appium_python_client-5.2.2.dist-info → appium_python_client-5.2.3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|