selenium-query 0.3.2__tar.gz → 0.3.3__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.
Files changed (23) hide show
  1. {selenium_query-0.3.2 → selenium_query-0.3.3}/PKG-INFO +31 -5
  2. selenium_query-0.3.2/selenium_query/__init__.py → selenium_query-0.3.3/README.md +30 -19
  3. {selenium_query-0.3.2 → selenium_query-0.3.3}/pyproject.toml +1 -1
  4. selenium_query-0.3.2/README.md → selenium_query-0.3.3/selenium_query/__init__.py +45 -4
  5. selenium_query-0.3.3/selenium_query/__version__.py +1 -0
  6. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_basics/base_getter.py +1 -1
  7. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_filter_getter.py +2 -2
  8. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/base_selenium_page.py +0 -1
  9. selenium_query-0.3.2/selenium_query/__version__.py +0 -1
  10. {selenium_query-0.3.2 → selenium_query-0.3.3}/LICENSE +0 -0
  11. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_any_all_getters.py +0 -0
  12. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_asserter_getter.py +0 -0
  13. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_basics/__init__.py +0 -0
  14. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_basics/action_getter.py +0 -0
  15. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_basics/boolean_getter.py +0 -0
  16. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_basics/generic_value_getter.py +0 -0
  17. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_mapper_getter.py +0 -0
  18. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_negation_transmitter.py +0 -0
  19. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_order_getter.py +0 -0
  20. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_types_and_tools.py +0 -0
  21. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/_values_getter.py +0 -0
  22. {selenium_query-0.3.2 → selenium_query-0.3.3}/selenium_query/colors.py +0 -0
  23. {selenium_query-0.3.2 → selenium_query-0.3.3}/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.2
3
+ Version: 0.3.3
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
@@ -113,6 +113,7 @@ A `Getter` represents the current collection of matching elements and provides a
113
113
  is_displayed()
114
114
  exists() - extra
115
115
  count(n) - extra
116
+ clear() - semi-extra (works only on inputs/textarea)
116
117
  ```
117
118
 
118
119
  Note: when used without "helpers" properties (see below), these behave like predicates. See implementation details.
@@ -142,10 +143,11 @@ A `Getter` represents the current collection of matching elements and provides a
142
143
  release
143
144
  pause
144
145
  scroll_to - behaves differently from selenium
145
- __getitem__ - extra (index or slice)
146
146
  ```
147
147
 
148
- * It also adds its own helpers, to change the behaviors of the main observers (see above):
148
+ * It also adds its own accessors and helpers, to change the behaviors of the main observers (see above):
149
+
150
+ ___Accessors:___
149
151
 
150
152
  ```python
151
153
  items = MyPage.find(".item")
@@ -160,6 +162,31 @@ A `Getter` represents the current collection of matching elements and provides a
160
162
  items.not_ # revert the behavior (for check.not_, filter.not_, all.not_ or not_.all, ...)
161
163
  ```
162
164
 
165
+ ___Helpers:___
166
+
167
+ ```
168
+ find(css_selector, *, in_page=False, as_="")
169
+ -> Search for children (or in the page if in_page is True)
170
+
171
+ __iter__
172
+ -> send each element of the collection as an individual Getter.
173
+
174
+ __getitem__
175
+ -> index or slice. Returned as Getter.
176
+
177
+ run_js(code:str, *args, async_=False, with_promise=True)
178
+ -> Execute JS code in te browser.
179
+
180
+ wait_for_element(css_selector, as_="", *, timeout:float=None, error=False)
181
+ -> Wait for the given element to show up and returns it (as Getter).
182
+ If timeout is not None and waiting too long, TimeoutError() is returned instead, unless `error=True` (then it is raised).
183
+
184
+ wait_until(truthy_provider) -> None
185
+
186
+ wait_prompt_or_alert() -> Alert
187
+ ```
188
+
189
+
163
190
  For example (each method is a different way to use selenium query objects):
164
191
 
165
192
  ```python
@@ -976,8 +1003,7 @@ For a direct element wait, the page exposes:
976
1003
 
977
1004
  ```python
978
1005
  @classmethod
979
- def wait_for_element(cls, css_selector):
980
- return cls._getter.wait_for_element(css_selector)
1006
+ def wait_for_element(cls, css_selector, as_="", *, timeout=None, error=False)
981
1007
  ```
982
1008
 
983
1009
  Example:
@@ -1,4 +1,3 @@
1
- """
2
1
  # Selenium Query
3
2
 
4
3
 
@@ -96,6 +95,7 @@ A `Getter` represents the current collection of matching elements and provides a
96
95
  is_displayed()
97
96
  exists() - extra
98
97
  count(n) - extra
98
+ clear() - semi-extra (works only on inputs/textarea)
99
99
  ```
100
100
 
101
101
  Note: when used without "helpers" properties (see below), these behave like predicates. See implementation details.
@@ -125,10 +125,11 @@ A `Getter` represents the current collection of matching elements and provides a
125
125
  release
126
126
  pause
127
127
  scroll_to - behaves differently from selenium
128
- __getitem__ - extra (index or slice)
129
128
  ```
130
129
 
131
- * It also adds its own helpers, to change the behaviors of the main observers (see above):
130
+ * It also adds its own accessors and helpers, to change the behaviors of the main observers (see above):
131
+
132
+ ___Accessors:___
132
133
 
133
134
  ```python
134
135
  items = MyPage.find(".item")
@@ -143,6 +144,31 @@ A `Getter` represents the current collection of matching elements and provides a
143
144
  items.not_ # revert the behavior (for check.not_, filter.not_, all.not_ or not_.all, ...)
144
145
  ```
145
146
 
147
+ ___Helpers:___
148
+
149
+ ```
150
+ find(css_selector, *, in_page=False, as_="")
151
+ -> Search for children (or in the page if in_page is True)
152
+
153
+ __iter__
154
+ -> send each element of the collection as an individual Getter.
155
+
156
+ __getitem__
157
+ -> index or slice. Returned as Getter.
158
+
159
+ run_js(code:str, *args, async_=False, with_promise=True)
160
+ -> Execute JS code in te browser.
161
+
162
+ wait_for_element(css_selector, as_="", *, timeout:float=None, error=False)
163
+ -> Wait for the given element to show up and returns it (as Getter).
164
+ If timeout is not None and waiting too long, TimeoutError() is returned instead, unless `error=True` (then it is raised).
165
+
166
+ wait_until(truthy_provider) -> None
167
+
168
+ wait_prompt_or_alert() -> Alert
169
+ ```
170
+
171
+
146
172
  For example (each method is a different way to use selenium query objects):
147
173
 
148
174
  ```python
@@ -959,8 +985,7 @@ For a direct element wait, the page exposes:
959
985
 
960
986
  ```python
961
987
  @classmethod
962
- def wait_for_element(cls, css_selector):
963
- return cls._getter.wait_for_element(css_selector)
988
+ def wait_for_element(cls, css_selector, as_="", *, timeout=None, error=False)
964
989
  ```
965
990
 
966
991
  Example:
@@ -1261,17 +1286,3 @@ page.find("css selector")
1261
1286
  ```
1262
1287
 
1263
1288
  `BaseSeleniumPage` is therefore not just a convenience wrapper around `WebDriver`: it is the page-level abstraction that owns the browser context, synchronization, page loading, caching and the root from which Selenium Query collections are created.
1264
-
1265
- """
1266
-
1267
- from .colors import use_colors, color, Color
1268
- from ._types_and_tools import center_of
1269
- from .getter import Getter
1270
- from ._any_all_getters import BoolAnyGetter, BoolAllGetter
1271
- from ._values_getter import ValuesGetter
1272
- from ._asserter_getter import AsserterGetter
1273
- from ._filter_getter import FilterGetter
1274
- from ._order_getter import OrderGetter
1275
- from ._mapper_getter import MapperGetter
1276
- from ._negation_transmitter import NotTransmitter
1277
- from .base_selenium_page import BaseSeleniumPage, depends_on
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "selenium-query"
3
- version = "0.3.2"
3
+ version = "0.3.3"
4
4
  description = "Python equivalent of jQuery, to write selenium tests."
5
5
  license = { text = "GPL-3.0-or-later" }
6
6
  authors = [
@@ -1,3 +1,4 @@
1
+ """
1
2
  # Selenium Query
2
3
 
3
4
 
@@ -95,6 +96,7 @@ A `Getter` represents the current collection of matching elements and provides a
95
96
  is_displayed()
96
97
  exists() - extra
97
98
  count(n) - extra
99
+ clear() - semi-extra (works only on inputs/textarea)
98
100
  ```
99
101
 
100
102
  Note: when used without "helpers" properties (see below), these behave like predicates. See implementation details.
@@ -124,10 +126,11 @@ A `Getter` represents the current collection of matching elements and provides a
124
126
  release
125
127
  pause
126
128
  scroll_to - behaves differently from selenium
127
- __getitem__ - extra (index or slice)
128
129
  ```
129
130
 
130
- * It also adds its own helpers, to change the behaviors of the main observers (see above):
131
+ * It also adds its own accessors and helpers, to change the behaviors of the main observers (see above):
132
+
133
+ ___Accessors:___
131
134
 
132
135
  ```python
133
136
  items = MyPage.find(".item")
@@ -142,6 +145,31 @@ A `Getter` represents the current collection of matching elements and provides a
142
145
  items.not_ # revert the behavior (for check.not_, filter.not_, all.not_ or not_.all, ...)
143
146
  ```
144
147
 
148
+ ___Helpers:___
149
+
150
+ ```
151
+ find(css_selector, *, in_page=False, as_="")
152
+ -> Search for children (or in the page if in_page is True)
153
+
154
+ __iter__
155
+ -> send each element of the collection as an individual Getter.
156
+
157
+ __getitem__
158
+ -> index or slice. Returned as Getter.
159
+
160
+ run_js(code:str, *args, async_=False, with_promise=True)
161
+ -> Execute JS code in te browser.
162
+
163
+ wait_for_element(css_selector, as_="", *, timeout:float=None, error=False)
164
+ -> Wait for the given element to show up and returns it (as Getter).
165
+ If timeout is not None and waiting too long, TimeoutError() is returned instead, unless `error=True` (then it is raised).
166
+
167
+ wait_until(truthy_provider) -> None
168
+
169
+ wait_prompt_or_alert() -> Alert
170
+ ```
171
+
172
+
145
173
  For example (each method is a different way to use selenium query objects):
146
174
 
147
175
  ```python
@@ -958,8 +986,7 @@ For a direct element wait, the page exposes:
958
986
 
959
987
  ```python
960
988
  @classmethod
961
- def wait_for_element(cls, css_selector):
962
- return cls._getter.wait_for_element(css_selector)
989
+ def wait_for_element(cls, css_selector, as_="", *, timeout=None, error=False)
963
990
  ```
964
991
 
965
992
  Example:
@@ -1260,3 +1287,17 @@ page.find("css selector")
1260
1287
  ```
1261
1288
 
1262
1289
  `BaseSeleniumPage` is therefore not just a convenience wrapper around `WebDriver`: it is the page-level abstraction that owns the browser context, synchronization, page loading, caching and the root from which Selenium Query collections are created.
1290
+
1291
+ """
1292
+
1293
+ from .colors import use_colors, color, Color
1294
+ from ._types_and_tools import center_of
1295
+ from .getter import Getter
1296
+ from ._any_all_getters import BoolAnyGetter, BoolAllGetter
1297
+ from ._values_getter import ValuesGetter
1298
+ from ._asserter_getter import AsserterGetter
1299
+ from ._filter_getter import FilterGetter
1300
+ from ._order_getter import OrderGetter
1301
+ from ._mapper_getter import MapperGetter
1302
+ from ._negation_transmitter import NotTransmitter
1303
+ from .base_selenium_page import BaseSeleniumPage, depends_on
@@ -0,0 +1 @@
1
+ __version__ = "0.3.3"
@@ -140,7 +140,7 @@ class BaseGetter:
140
140
  return getattr(self.driver, method)(code, *args)
141
141
 
142
142
 
143
- def wait_for_element(self, css_selector, as_="", *, timeout=None, error=False):
143
+ def wait_for_element(self, css_selector, as_="", *, timeout:float=None, error=False):
144
144
  if self._actions:
145
145
  raise ValueError(f"Cannot use `wait_until(...)` on objects with defined ActionChains.")
146
146
 
@@ -26,8 +26,8 @@ from .getter import Getter
26
26
  class FilterGetter(Getter, accessor="filter"):
27
27
  """
28
28
  Accessible through `Getter.filter`.
29
- Transform the css, data, props, ... methods into filters: each of them now returns a
30
- new FilterGetter instance whose the elements are only containing those which match the
29
+ Transform the css, data, props, ... methods into filters: each of them now returns
30
+ a new Getter instance whose the elements are only containing those which match the
31
31
  desired values.
32
32
 
33
33
  Basic usage:
@@ -188,7 +188,6 @@ class BaseSeleniumPage:
188
188
  url = cls.get_address_from_class_url(address)
189
189
 
190
190
  if url == cls._LAST_LOADED_PAGE:
191
- print(cls.URL, 'cached...')
192
191
  return
193
192
 
194
193
  BaseSeleniumPage._LAST_LOADED_PAGE = url
@@ -1 +0,0 @@
1
- __version__ = "0.3.2"
File without changes