selenium-query 0.3.0__tar.gz → 0.3.2__tar.gz
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.
- {selenium_query-0.3.0 → selenium_query-0.3.2}/PKG-INFO +7 -12
- {selenium_query-0.3.0 → selenium_query-0.3.2}/README.md +6 -11
- {selenium_query-0.3.0 → selenium_query-0.3.2}/pyproject.toml +1 -1
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/__init__.py +7 -12
- selenium_query-0.3.2/selenium_query/__version__.py +1 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_basics/base_getter.py +8 -9
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/base_selenium_page.py +24 -20
- selenium_query-0.3.0/selenium_query/__version__.py +0 -1
- {selenium_query-0.3.0 → selenium_query-0.3.2}/LICENSE +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_any_all_getters.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_asserter_getter.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_basics/__init__.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_basics/action_getter.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_basics/boolean_getter.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_basics/generic_value_getter.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_filter_getter.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_mapper_getter.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_negation_transmitter.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_order_getter.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_types_and_tools.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_values_getter.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/colors.py +0 -0
- {selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/getter.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: selenium-query
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Python equivalent of jQuery, to write selenium tests.
|
|
5
5
|
License: GPL-3.0-or-later
|
|
6
6
|
Author: Frédéric Zinelli
|
|
@@ -639,14 +639,12 @@ The important relationship is:
|
|
|
639
639
|
|
|
640
640
|
```text
|
|
641
641
|
BaseSeleniumPage
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
│
|
|
649
|
-
query
|
|
642
|
+
├── driver
|
|
643
|
+
├── waiter
|
|
644
|
+
└── Getter
|
|
645
|
+
└── find(...)
|
|
646
|
+
│
|
|
647
|
+
query
|
|
650
648
|
```
|
|
651
649
|
|
|
652
650
|
In normal user code, the query API starts with:
|
|
@@ -703,13 +701,11 @@ The expected model is:
|
|
|
703
701
|
|
|
704
702
|
```text
|
|
705
703
|
load_url()
|
|
706
|
-
│
|
|
707
704
|
├── load the URL
|
|
708
705
|
├── wait until the page is ready
|
|
709
706
|
└── gather shared page data
|
|
710
707
|
|
|
711
708
|
data()
|
|
712
|
-
│
|
|
713
709
|
└── build data specific to the subclass
|
|
714
710
|
```
|
|
715
711
|
|
|
@@ -1261,7 +1257,6 @@ Both make also use of the [`pmt-tools`](https://gitlab.com/frederic-zinelli/pmt_
|
|
|
1261
1257
|
Selenium environment
|
|
1262
1258
|
↓
|
|
1263
1259
|
BaseSeleniumPage
|
|
1264
|
-
│
|
|
1265
1260
|
├── load URL
|
|
1266
1261
|
├── wait for readiness
|
|
1267
1262
|
├── gather data
|
|
@@ -621,14 +621,12 @@ The important relationship is:
|
|
|
621
621
|
|
|
622
622
|
```text
|
|
623
623
|
BaseSeleniumPage
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
│
|
|
631
|
-
query
|
|
624
|
+
├── driver
|
|
625
|
+
├── waiter
|
|
626
|
+
└── Getter
|
|
627
|
+
└── find(...)
|
|
628
|
+
│
|
|
629
|
+
query
|
|
632
630
|
```
|
|
633
631
|
|
|
634
632
|
In normal user code, the query API starts with:
|
|
@@ -685,13 +683,11 @@ The expected model is:
|
|
|
685
683
|
|
|
686
684
|
```text
|
|
687
685
|
load_url()
|
|
688
|
-
│
|
|
689
686
|
├── load the URL
|
|
690
687
|
├── wait until the page is ready
|
|
691
688
|
└── gather shared page data
|
|
692
689
|
|
|
693
690
|
data()
|
|
694
|
-
│
|
|
695
691
|
└── build data specific to the subclass
|
|
696
692
|
```
|
|
697
693
|
|
|
@@ -1243,7 +1239,6 @@ Both make also use of the [`pmt-tools`](https://gitlab.com/frederic-zinelli/pmt_
|
|
|
1243
1239
|
Selenium environment
|
|
1244
1240
|
↓
|
|
1245
1241
|
BaseSeleniumPage
|
|
1246
|
-
│
|
|
1247
1242
|
├── load URL
|
|
1248
1243
|
├── wait for readiness
|
|
1249
1244
|
├── gather data
|
|
@@ -622,14 +622,12 @@ The important relationship is:
|
|
|
622
622
|
|
|
623
623
|
```text
|
|
624
624
|
BaseSeleniumPage
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
│
|
|
632
|
-
query
|
|
625
|
+
├── driver
|
|
626
|
+
├── waiter
|
|
627
|
+
└── Getter
|
|
628
|
+
└── find(...)
|
|
629
|
+
│
|
|
630
|
+
query
|
|
633
631
|
```
|
|
634
632
|
|
|
635
633
|
In normal user code, the query API starts with:
|
|
@@ -686,13 +684,11 @@ The expected model is:
|
|
|
686
684
|
|
|
687
685
|
```text
|
|
688
686
|
load_url()
|
|
689
|
-
│
|
|
690
687
|
├── load the URL
|
|
691
688
|
├── wait until the page is ready
|
|
692
689
|
└── gather shared page data
|
|
693
690
|
|
|
694
691
|
data()
|
|
695
|
-
│
|
|
696
692
|
└── build data specific to the subclass
|
|
697
693
|
```
|
|
698
694
|
|
|
@@ -1244,7 +1240,6 @@ Both make also use of the [`pmt-tools`](https://gitlab.com/frederic-zinelli/pmt_
|
|
|
1244
1240
|
Selenium environment
|
|
1245
1241
|
↓
|
|
1246
1242
|
BaseSeleniumPage
|
|
1247
|
-
│
|
|
1248
1243
|
├── load URL
|
|
1249
1244
|
├── wait for readiness
|
|
1250
1245
|
├── gather data
|
|
@@ -1279,4 +1274,4 @@ from ._filter_getter import FilterGetter
|
|
|
1279
1274
|
from ._order_getter import OrderGetter
|
|
1280
1275
|
from ._mapper_getter import MapperGetter
|
|
1281
1276
|
from ._negation_transmitter import NotTransmitter
|
|
1282
|
-
from .base_selenium_page import BaseSeleniumPage
|
|
1277
|
+
from .base_selenium_page import BaseSeleniumPage, depends_on
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.2"
|
|
@@ -140,25 +140,24 @@ class BaseGetter:
|
|
|
140
140
|
return getattr(self.driver, method)(code, *args)
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
def wait_for_element(self, css_selector, as_=""):
|
|
143
|
+
def wait_for_element(self, css_selector, as_="", *, timeout=None, error=False):
|
|
144
144
|
if self._actions:
|
|
145
145
|
raise ValueError(f"Cannot use `wait_until(...)` on objects with defined ActionChains.")
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
delta = dt.timedelta(seconds=0.05)
|
|
147
|
+
timeout = timeout and dt.datetime.now() + dt.timedelta(seconds=timeout)
|
|
149
148
|
|
|
150
149
|
def finder(_):
|
|
151
|
-
|
|
150
|
+
if timeout and dt.datetime.now() > timeout:
|
|
151
|
+
if error:
|
|
152
|
+
raise TimeoutError()
|
|
153
|
+
return TimeoutError() # truthy!
|
|
152
154
|
|
|
153
155
|
elt = self.find(css_selector, in_page=True, as_=as_)
|
|
154
156
|
found = elt.exists() and elt
|
|
155
157
|
if found:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if dt.datetime.now() - date > delta:
|
|
159
|
-
return found
|
|
158
|
+
elt.pause(0.05).go
|
|
159
|
+
return elt
|
|
160
160
|
return False
|
|
161
|
-
|
|
162
161
|
return self.waiter.until(finder)
|
|
163
162
|
|
|
164
163
|
|
|
@@ -28,6 +28,23 @@ from selenium_query import Getter
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
def depends_on(src_method:Callable, *, pass_args=False):
|
|
32
|
+
"""
|
|
33
|
+
If @pass_args is True, all arguments of the current method will also be passed to the method
|
|
34
|
+
it depends on (might be useful for tests with fixtures or dependencies).
|
|
35
|
+
"""
|
|
36
|
+
def decorator(method):
|
|
37
|
+
@wraps(method)
|
|
38
|
+
def wrapper(self:BaseSeleniumPage, *a, **kw):
|
|
39
|
+
if src_method.__name__ not in self._methods_run:
|
|
40
|
+
if pass_args:
|
|
41
|
+
src_method(self, *a, **kw)
|
|
42
|
+
else:
|
|
43
|
+
src_method(self)
|
|
44
|
+
return method(self, *a, **kw)
|
|
45
|
+
return wrapper
|
|
46
|
+
return decorator
|
|
47
|
+
|
|
31
48
|
|
|
32
49
|
|
|
33
50
|
|
|
@@ -100,6 +117,10 @@ class BaseSeleniumPage:
|
|
|
100
117
|
#----------------------------------------------------------------------------------------------
|
|
101
118
|
|
|
102
119
|
|
|
120
|
+
depends_on = staticmethod(depends_on)
|
|
121
|
+
# Relay to make it possible to use/access it through the class
|
|
122
|
+
|
|
123
|
+
|
|
103
124
|
def __init_subclass__(cls):
|
|
104
125
|
"""
|
|
105
126
|
Wrap all tests methods with an automatic "method execution tracking logistic", to know what
|
|
@@ -130,26 +151,9 @@ class BaseSeleniumPage:
|
|
|
130
151
|
setattr(cls, name, track_run_methods(method))
|
|
131
152
|
|
|
132
153
|
|
|
133
|
-
@staticmethod
|
|
134
|
-
def depends_on(src_method:Callable, *, pass_args=False):
|
|
135
|
-
"""
|
|
136
|
-
If @pass_args is True, all arguments of the current method will also be passed to the method
|
|
137
|
-
it depends on (might be useful for tests with fixtures or dependencies).
|
|
138
|
-
"""
|
|
139
|
-
def decorator(method):
|
|
140
|
-
@wraps(method)
|
|
141
|
-
def wrapper(self:BaseSeleniumPage, *a, **kw):
|
|
142
|
-
if src_method.__name__ not in self._methods_run:
|
|
143
|
-
if pass_args:
|
|
144
|
-
src_method(self, *a, **kw)
|
|
145
|
-
else:
|
|
146
|
-
src_method(self)
|
|
147
|
-
return method(self, *a, **kw)
|
|
148
|
-
return wrapper
|
|
149
|
-
return decorator
|
|
150
|
-
|
|
151
154
|
#----------------------------------------------------------------------------------------------
|
|
152
155
|
|
|
156
|
+
|
|
153
157
|
#@Fixture(scope="module", autouse=True)
|
|
154
158
|
@classmethod
|
|
155
159
|
def load_url(cls, clean_cache, selenium_env: Tuple[str,str,WebDriver]):
|
|
@@ -258,8 +262,8 @@ class BaseSeleniumPage:
|
|
|
258
262
|
|
|
259
263
|
|
|
260
264
|
@classmethod
|
|
261
|
-
def wait_for_element(cls, css_selector:str):
|
|
262
|
-
return cls._getter.wait_for_element(css_selector)
|
|
265
|
+
def wait_for_element(cls, css_selector:str, as_="", *, timeout=None, error=False):
|
|
266
|
+
return cls._getter.wait_for_element(css_selector, as_=as_, timeout=timeout, error=error)
|
|
263
267
|
|
|
264
268
|
|
|
265
269
|
@classmethod
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{selenium_query-0.3.0 → selenium_query-0.3.2}/selenium_query/_basics/generic_value_getter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|