pomcorn 0.5.0__py3-none-any.whl → 0.6.0__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.
Potentially problematic release.
This version of pomcorn might be problematic. Click here for more details.
- pomcorn/component.py +2 -2
- pomcorn/locators/xpath_locators.py +28 -1
- pomcorn/page.py +8 -4
- {pomcorn-0.5.0.dist-info → pomcorn-0.6.0.dist-info}/METADATA +1 -1
- {pomcorn-0.5.0.dist-info → pomcorn-0.6.0.dist-info}/RECORD +7 -7
- {pomcorn-0.5.0.dist-info → pomcorn-0.6.0.dist-info}/WHEEL +1 -1
- {pomcorn-0.5.0.dist-info → pomcorn-0.6.0.dist-info}/LICENSE +0 -0
pomcorn/component.py
CHANGED
|
@@ -45,7 +45,7 @@ class ComponentWithBaseLocator(Generic[TPage], Component[TPage]):
|
|
|
45
45
|
|
|
46
46
|
Args:
|
|
47
47
|
page: An instance of the page that uses this component.
|
|
48
|
-
base_locator:
|
|
48
|
+
base_locator: Instance of a class to locate the element in
|
|
49
49
|
the browser. Used in relative element initialization methods
|
|
50
50
|
and visibility waits. You also can specify it as attribute.
|
|
51
51
|
wait_until_visible: Whether to wait for the component to become
|
|
@@ -251,7 +251,7 @@ class ListComponent(
|
|
|
251
251
|
|
|
252
252
|
items: list[ListItemType] = []
|
|
253
253
|
for locator in self.iter_locators(self.base_item_locator):
|
|
254
|
-
items.append(self.item_class(self.page, locator))
|
|
254
|
+
items.append(self.item_class(page=self.page, base_locator=locator))
|
|
255
255
|
return items
|
|
256
256
|
|
|
257
257
|
def get_item_by_text(self, text: str) -> ListItemType:
|
|
@@ -200,13 +200,18 @@ class ButtonWithTextLocator(ElementWithTextLocator):
|
|
|
200
200
|
super().__init__(text=text, element="button", exact=exact)
|
|
201
201
|
|
|
202
202
|
|
|
203
|
-
class
|
|
203
|
+
class InputInLabelLocator(XPathLocator):
|
|
204
204
|
"""Locator to looking for input with label by XPath.
|
|
205
205
|
|
|
206
206
|
Specify the query as the string
|
|
207
207
|
``//label[contains(., "label")]//input``, where ``label`` is the text of
|
|
208
208
|
the input label.
|
|
209
209
|
|
|
210
|
+
Example:
|
|
211
|
+
<label>Title</label>
|
|
212
|
+
<input value="Value">
|
|
213
|
+
</label>
|
|
214
|
+
|
|
210
215
|
"""
|
|
211
216
|
|
|
212
217
|
def __init__(self, label: str):
|
|
@@ -216,6 +221,28 @@ class InputByLabelLocator(XPathLocator):
|
|
|
216
221
|
)
|
|
217
222
|
|
|
218
223
|
|
|
224
|
+
class InputByLabelLocator(XPathLocator):
|
|
225
|
+
"""Locator to looking for input next to label by XPath.
|
|
226
|
+
|
|
227
|
+
Specify the query as the string
|
|
228
|
+
``//label[contains(., "label")]/following-sibling::input``, where ``label``
|
|
229
|
+
is the text of the input label.
|
|
230
|
+
|
|
231
|
+
Example:
|
|
232
|
+
<div>
|
|
233
|
+
<label for="InputWithLabel">Title</label>
|
|
234
|
+
<input id="InputWithLabel" value="Value">
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
def __init__(self, label: str):
|
|
240
|
+
"""Init XPathLocator."""
|
|
241
|
+
super().__init__(
|
|
242
|
+
query=f'//label[contains(., "{label}")]/following-sibling::input',
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
|
|
219
246
|
class TextAreaByLabelLocator(XPathLocator):
|
|
220
247
|
"""Locator to looking for textarea with label by XPath.
|
|
221
248
|
|
pomcorn/page.py
CHANGED
|
@@ -3,7 +3,6 @@ from typing import Self
|
|
|
3
3
|
from selenium.common.exceptions import TimeoutException
|
|
4
4
|
from selenium.webdriver.remote.webdriver import WebDriver
|
|
5
5
|
|
|
6
|
-
from . import locators
|
|
7
6
|
from .exceptions import PageDidNotLoadedError
|
|
8
7
|
from .web_view import WebView
|
|
9
8
|
|
|
@@ -146,14 +145,19 @@ class Page(WebView):
|
|
|
146
145
|
self._get_full_relative_url(self.app_root, relative_url),
|
|
147
146
|
)
|
|
148
147
|
|
|
149
|
-
def click_on_page(self):
|
|
150
|
-
"""Click on
|
|
148
|
+
def click_on_page(self) -> None:
|
|
149
|
+
"""Click on (1, 1) coordinates in the upper left corner of the page.
|
|
151
150
|
|
|
152
151
|
Allows you to move focus away from an element, for example, if it
|
|
153
152
|
is currently unavailable for interaction.
|
|
154
153
|
|
|
155
154
|
"""
|
|
156
|
-
|
|
155
|
+
from selenium.webdriver.common.action_chains import ActionChains
|
|
156
|
+
|
|
157
|
+
ActionChains(self.webdriver).move_by_offset(
|
|
158
|
+
xoffset=1, # cspell:disable-line
|
|
159
|
+
yoffset=1, # cspell:disable-line
|
|
160
|
+
).click().perform()
|
|
157
161
|
|
|
158
162
|
@staticmethod
|
|
159
163
|
def _get_full_relative_url(app_root: str, relative_url: str) -> str:
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
pomcorn/__init__.py,sha256=-0WkJfyev7Onx4Z4BhcWVpZS75GhCLt_oyjHBIjjXC8,362
|
|
2
|
-
pomcorn/component.py,sha256=
|
|
2
|
+
pomcorn/component.py,sha256=gA9KU2a46o7WYMUvQlG4oGGFN43MDjb1av6I_KK2etQ,8632
|
|
3
3
|
pomcorn/element.py,sha256=rInhUgDzBr49VSyMsCuxCuSIKA2VIbQnTYOlAevQ5DY,12195
|
|
4
4
|
pomcorn/exceptions.py,sha256=8ZOmrybDwvEVZRLQzyozjRNhJvSLbablaFwGFUVMhrU,1131
|
|
5
5
|
pomcorn/locators/__init__.py,sha256=hNSlfmz3y-LI4PXF5VIwX8J5WSalyE2wmzuYc6kNxMA,708
|
|
6
6
|
pomcorn/locators/base_locators.py,sha256=OegetP1kSzVriLrOj5a_Uu3x9VDXlcgpB9xyO7LW_PA,4432
|
|
7
|
-
pomcorn/locators/xpath_locators.py,sha256=
|
|
8
|
-
pomcorn/page.py,sha256=
|
|
7
|
+
pomcorn/locators/xpath_locators.py,sha256=mmhNH_S6yUIEuFfSvryY97x-COVrr16cxpxIoae593c,7202
|
|
8
|
+
pomcorn/page.py,sha256=u3DfFdVRxBaXRvFMfrCssr8_ZeA0EJW5UOEjFJjcK4k,5436
|
|
9
9
|
pomcorn/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
pomcorn/waits_conditions.py,sha256=0H2qKCZod8YJC2iTl-urys-A_k0P3zDCenFyUL6hEfw,3493
|
|
11
11
|
pomcorn/web_view.py,sha256=OenE6H3Vt_1rXt3XHlzdSoNdRV3kkh2O993MO0UJ5c4,14179
|
|
12
|
-
pomcorn-0.
|
|
13
|
-
pomcorn-0.
|
|
14
|
-
pomcorn-0.
|
|
15
|
-
pomcorn-0.
|
|
12
|
+
pomcorn-0.6.0.dist-info/LICENSE,sha256=1vmhQNp1dDH8ksJ199LuG4oKz5D4ZvNccPcFckiG2S4,1091
|
|
13
|
+
pomcorn-0.6.0.dist-info/METADATA,sha256=8_OXIUBARDkybQWRzD6U-cAvxcLXTLez5UScKJ5vIwI,6644
|
|
14
|
+
pomcorn-0.6.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
15
|
+
pomcorn-0.6.0.dist-info/RECORD,,
|
|
File without changes
|