selenium 4.0.0.rc1__y3-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.
Files changed (252) hide show
  1. selenium/__init__.py +19 -0
  2. selenium/common/__init__.py +18 -0
  3. selenium/common/exceptions.py +317 -0
  4. selenium/types.py +23 -0
  5. selenium/webdriver/__init__.py +41 -0
  6. selenium/webdriver/chrome/__init__.py +16 -0
  7. selenium/webdriver/chrome/options.py +29 -0
  8. selenium/webdriver/chrome/service.py +44 -0
  9. selenium/webdriver/chrome/webdriver.py +72 -0
  10. selenium/webdriver/chromium/__init__.py +16 -0
  11. selenium/webdriver/chromium/options.py +187 -0
  12. selenium/webdriver/chromium/remote_connection.py +33 -0
  13. selenium/webdriver/chromium/service.py +48 -0
  14. selenium/webdriver/chromium/webdriver.py +217 -0
  15. selenium/webdriver/common/__init__.py +16 -0
  16. selenium/webdriver/common/action_chains.py +329 -0
  17. selenium/webdriver/common/actions/__init__.py +16 -0
  18. selenium/webdriver/common/actions/action_builder.py +86 -0
  19. selenium/webdriver/common/actions/input_device.py +43 -0
  20. selenium/webdriver/common/actions/interaction.py +50 -0
  21. selenium/webdriver/common/actions/key_actions.py +50 -0
  22. selenium/webdriver/common/actions/key_input.py +51 -0
  23. selenium/webdriver/common/actions/mouse_button.py +23 -0
  24. selenium/webdriver/common/actions/pointer_actions.py +109 -0
  25. selenium/webdriver/common/actions/pointer_input.py +63 -0
  26. selenium/webdriver/common/alert.py +90 -0
  27. selenium/webdriver/common/bidi/__init__.py +16 -0
  28. selenium/webdriver/common/bidi/cdp.py +483 -0
  29. selenium/webdriver/common/bidi/console.py +25 -0
  30. selenium/webdriver/common/by.py +35 -0
  31. selenium/webdriver/common/desired_capabilities.py +113 -0
  32. selenium/webdriver/common/devtools/v85/__init__.py +51 -0
  33. selenium/webdriver/common/devtools/v85/accessibility.py +455 -0
  34. selenium/webdriver/common/devtools/v85/animation.py +415 -0
  35. selenium/webdriver/common/devtools/v85/application_cache.py +205 -0
  36. selenium/webdriver/common/devtools/v85/audits.py +527 -0
  37. selenium/webdriver/common/devtools/v85/background_service.py +208 -0
  38. selenium/webdriver/common/devtools/v85/browser.py +579 -0
  39. selenium/webdriver/common/devtools/v85/cache_storage.py +287 -0
  40. selenium/webdriver/common/devtools/v85/cast.py +153 -0
  41. selenium/webdriver/common/devtools/v85/console.py +105 -0
  42. selenium/webdriver/common/devtools/v85/css.py +1365 -0
  43. selenium/webdriver/common/devtools/v85/database.py +162 -0
  44. selenium/webdriver/common/devtools/v85/debugger.py +1209 -0
  45. selenium/webdriver/common/devtools/v85/device_orientation.py +43 -0
  46. selenium/webdriver/common/devtools/v85/dom.py +1747 -0
  47. selenium/webdriver/common/devtools/v85/dom_debugger.py +278 -0
  48. selenium/webdriver/common/devtools/v85/dom_snapshot.py +837 -0
  49. selenium/webdriver/common/devtools/v85/dom_storage.py +201 -0
  50. selenium/webdriver/common/devtools/v85/emulation.py +658 -0
  51. selenium/webdriver/common/devtools/v85/fetch.py +446 -0
  52. selenium/webdriver/common/devtools/v85/headless_experimental.py +116 -0
  53. selenium/webdriver/common/devtools/v85/heap_profiler.py +371 -0
  54. selenium/webdriver/common/devtools/v85/indexed_db.py +461 -0
  55. selenium/webdriver/common/devtools/v85/input_.py +477 -0
  56. selenium/webdriver/common/devtools/v85/inspector.py +76 -0
  57. selenium/webdriver/common/devtools/v85/io.py +99 -0
  58. selenium/webdriver/common/devtools/v85/layer_tree.py +462 -0
  59. selenium/webdriver/common/devtools/v85/log.py +183 -0
  60. selenium/webdriver/common/devtools/v85/media.py +251 -0
  61. selenium/webdriver/common/devtools/v85/memory.py +261 -0
  62. selenium/webdriver/common/devtools/v85/network.py +2640 -0
  63. selenium/webdriver/common/devtools/v85/overlay.py +698 -0
  64. selenium/webdriver/common/devtools/v85/page.py +2373 -0
  65. selenium/webdriver/common/devtools/v85/performance.py +116 -0
  66. selenium/webdriver/common/devtools/v85/profiler.py +596 -0
  67. selenium/webdriver/common/devtools/v85/py.typed +0 -0
  68. selenium/webdriver/common/devtools/v85/runtime.py +1437 -0
  69. selenium/webdriver/common/devtools/v85/schema.py +48 -0
  70. selenium/webdriver/common/devtools/v85/security.py +509 -0
  71. selenium/webdriver/common/devtools/v85/service_worker.py +409 -0
  72. selenium/webdriver/common/devtools/v85/storage.py +309 -0
  73. selenium/webdriver/common/devtools/v85/system_info.py +347 -0
  74. selenium/webdriver/common/devtools/v85/target.py +599 -0
  75. selenium/webdriver/common/devtools/v85/tethering.py +63 -0
  76. selenium/webdriver/common/devtools/v85/tracing.py +290 -0
  77. selenium/webdriver/common/devtools/v85/util.py +19 -0
  78. selenium/webdriver/common/devtools/v85/web_audio.py +603 -0
  79. selenium/webdriver/common/devtools/v85/web_authn.py +318 -0
  80. selenium/webdriver/common/devtools/v92/__init__.py +52 -0
  81. selenium/webdriver/common/devtools/v92/accessibility.py +527 -0
  82. selenium/webdriver/common/devtools/v92/animation.py +415 -0
  83. selenium/webdriver/common/devtools/v92/application_cache.py +205 -0
  84. selenium/webdriver/common/devtools/v92/audits.py +988 -0
  85. selenium/webdriver/common/devtools/v92/background_service.py +208 -0
  86. selenium/webdriver/common/devtools/v92/browser.py +697 -0
  87. selenium/webdriver/common/devtools/v92/cache_storage.py +287 -0
  88. selenium/webdriver/common/devtools/v92/cast.py +153 -0
  89. selenium/webdriver/common/devtools/v92/console.py +105 -0
  90. selenium/webdriver/common/devtools/v92/css.py +1475 -0
  91. selenium/webdriver/common/devtools/v92/database.py +162 -0
  92. selenium/webdriver/common/devtools/v92/debugger.py +1220 -0
  93. selenium/webdriver/common/devtools/v92/device_orientation.py +43 -0
  94. selenium/webdriver/common/devtools/v92/dom.py +1825 -0
  95. selenium/webdriver/common/devtools/v92/dom_debugger.py +312 -0
  96. selenium/webdriver/common/devtools/v92/dom_snapshot.py +857 -0
  97. selenium/webdriver/common/devtools/v92/dom_storage.py +201 -0
  98. selenium/webdriver/common/devtools/v92/emulation.py +764 -0
  99. selenium/webdriver/common/devtools/v92/fetch.py +446 -0
  100. selenium/webdriver/common/devtools/v92/headless_experimental.py +116 -0
  101. selenium/webdriver/common/devtools/v92/heap_profiler.py +379 -0
  102. selenium/webdriver/common/devtools/v92/indexed_db.py +461 -0
  103. selenium/webdriver/common/devtools/v92/input_.py +648 -0
  104. selenium/webdriver/common/devtools/v92/inspector.py +76 -0
  105. selenium/webdriver/common/devtools/v92/io.py +99 -0
  106. selenium/webdriver/common/devtools/v92/layer_tree.py +462 -0
  107. selenium/webdriver/common/devtools/v92/log.py +183 -0
  108. selenium/webdriver/common/devtools/v92/media.py +251 -0
  109. selenium/webdriver/common/devtools/v92/memory.py +261 -0
  110. selenium/webdriver/common/devtools/v92/network.py +3324 -0
  111. selenium/webdriver/common/devtools/v92/overlay.py +1195 -0
  112. selenium/webdriver/common/devtools/v92/page.py +2896 -0
  113. selenium/webdriver/common/devtools/v92/performance.py +116 -0
  114. selenium/webdriver/common/devtools/v92/performance_timeline.py +198 -0
  115. selenium/webdriver/common/devtools/v92/profiler.py +665 -0
  116. selenium/webdriver/common/devtools/v92/py.typed +0 -0
  117. selenium/webdriver/common/devtools/v92/runtime.py +1452 -0
  118. selenium/webdriver/common/devtools/v92/schema.py +48 -0
  119. selenium/webdriver/common/devtools/v92/security.py +509 -0
  120. selenium/webdriver/common/devtools/v92/service_worker.py +409 -0
  121. selenium/webdriver/common/devtools/v92/storage.py +396 -0
  122. selenium/webdriver/common/devtools/v92/system_info.py +347 -0
  123. selenium/webdriver/common/devtools/v92/target.py +611 -0
  124. selenium/webdriver/common/devtools/v92/tethering.py +63 -0
  125. selenium/webdriver/common/devtools/v92/tracing.py +340 -0
  126. selenium/webdriver/common/devtools/v92/util.py +19 -0
  127. selenium/webdriver/common/devtools/v92/web_audio.py +603 -0
  128. selenium/webdriver/common/devtools/v92/web_authn.py +380 -0
  129. selenium/webdriver/common/devtools/v93/__init__.py +52 -0
  130. selenium/webdriver/common/devtools/v93/accessibility.py +527 -0
  131. selenium/webdriver/common/devtools/v93/animation.py +415 -0
  132. selenium/webdriver/common/devtools/v93/application_cache.py +205 -0
  133. selenium/webdriver/common/devtools/v93/audits.py +1056 -0
  134. selenium/webdriver/common/devtools/v93/background_service.py +208 -0
  135. selenium/webdriver/common/devtools/v93/browser.py +697 -0
  136. selenium/webdriver/common/devtools/v93/cache_storage.py +287 -0
  137. selenium/webdriver/common/devtools/v93/cast.py +153 -0
  138. selenium/webdriver/common/devtools/v93/console.py +105 -0
  139. selenium/webdriver/common/devtools/v93/css.py +1551 -0
  140. selenium/webdriver/common/devtools/v93/database.py +162 -0
  141. selenium/webdriver/common/devtools/v93/debugger.py +1220 -0
  142. selenium/webdriver/common/devtools/v93/device_orientation.py +43 -0
  143. selenium/webdriver/common/devtools/v93/dom.py +1853 -0
  144. selenium/webdriver/common/devtools/v93/dom_debugger.py +312 -0
  145. selenium/webdriver/common/devtools/v93/dom_snapshot.py +863 -0
  146. selenium/webdriver/common/devtools/v93/dom_storage.py +201 -0
  147. selenium/webdriver/common/devtools/v93/emulation.py +764 -0
  148. selenium/webdriver/common/devtools/v93/fetch.py +446 -0
  149. selenium/webdriver/common/devtools/v93/headless_experimental.py +116 -0
  150. selenium/webdriver/common/devtools/v93/heap_profiler.py +379 -0
  151. selenium/webdriver/common/devtools/v93/indexed_db.py +461 -0
  152. selenium/webdriver/common/devtools/v93/input_.py +648 -0
  153. selenium/webdriver/common/devtools/v93/inspector.py +76 -0
  154. selenium/webdriver/common/devtools/v93/io.py +99 -0
  155. selenium/webdriver/common/devtools/v93/layer_tree.py +462 -0
  156. selenium/webdriver/common/devtools/v93/log.py +183 -0
  157. selenium/webdriver/common/devtools/v93/media.py +251 -0
  158. selenium/webdriver/common/devtools/v93/memory.py +261 -0
  159. selenium/webdriver/common/devtools/v93/network.py +3408 -0
  160. selenium/webdriver/common/devtools/v93/overlay.py +1259 -0
  161. selenium/webdriver/common/devtools/v93/page.py +3082 -0
  162. selenium/webdriver/common/devtools/v93/performance.py +116 -0
  163. selenium/webdriver/common/devtools/v93/performance_timeline.py +198 -0
  164. selenium/webdriver/common/devtools/v93/profiler.py +665 -0
  165. selenium/webdriver/common/devtools/v93/py.typed +0 -0
  166. selenium/webdriver/common/devtools/v93/runtime.py +1464 -0
  167. selenium/webdriver/common/devtools/v93/schema.py +48 -0
  168. selenium/webdriver/common/devtools/v93/security.py +509 -0
  169. selenium/webdriver/common/devtools/v93/service_worker.py +409 -0
  170. selenium/webdriver/common/devtools/v93/storage.py +396 -0
  171. selenium/webdriver/common/devtools/v93/system_info.py +347 -0
  172. selenium/webdriver/common/devtools/v93/target.py +611 -0
  173. selenium/webdriver/common/devtools/v93/tethering.py +63 -0
  174. selenium/webdriver/common/devtools/v93/tracing.py +340 -0
  175. selenium/webdriver/common/devtools/v93/util.py +19 -0
  176. selenium/webdriver/common/devtools/v93/web_audio.py +603 -0
  177. selenium/webdriver/common/devtools/v93/web_authn.py +380 -0
  178. selenium/webdriver/common/html5/__init__.py +16 -0
  179. selenium/webdriver/common/html5/application_cache.py +53 -0
  180. selenium/webdriver/common/keys.py +94 -0
  181. selenium/webdriver/common/log.py +155 -0
  182. selenium/webdriver/common/mutation-listener.js +55 -0
  183. selenium/webdriver/common/options.py +104 -0
  184. selenium/webdriver/common/print_page_options.py +285 -0
  185. selenium/webdriver/common/proxy.py +355 -0
  186. selenium/webdriver/common/service.py +182 -0
  187. selenium/webdriver/common/timeouts.py +114 -0
  188. selenium/webdriver/common/touch_actions.py +192 -0
  189. selenium/webdriver/common/utils.py +153 -0
  190. selenium/webdriver/common/window.py +27 -0
  191. selenium/webdriver/edge/__init__.py +16 -0
  192. selenium/webdriver/edge/options.py +65 -0
  193. selenium/webdriver/edge/service.py +51 -0
  194. selenium/webdriver/edge/webdriver.py +68 -0
  195. selenium/webdriver/firefox/__init__.py +16 -0
  196. selenium/webdriver/firefox/extension_connection.py +84 -0
  197. selenium/webdriver/firefox/firefox_binary.py +218 -0
  198. selenium/webdriver/firefox/firefox_profile.py +366 -0
  199. selenium/webdriver/firefox/options.py +200 -0
  200. selenium/webdriver/firefox/remote_connection.py +36 -0
  201. selenium/webdriver/firefox/service.py +56 -0
  202. selenium/webdriver/firefox/webdriver.py +333 -0
  203. selenium/webdriver/firefox/webdriver_prefs.json +69 -0
  204. selenium/webdriver/ie/__init__.py +16 -0
  205. selenium/webdriver/ie/options.py +374 -0
  206. selenium/webdriver/ie/service.py +54 -0
  207. selenium/webdriver/ie/webdriver.py +132 -0
  208. selenium/webdriver/opera/__init__.py +16 -0
  209. selenium/webdriver/opera/options.py +120 -0
  210. selenium/webdriver/opera/webdriver.py +74 -0
  211. selenium/webdriver/remote/__init__.py +16 -0
  212. selenium/webdriver/remote/bidi_connection.py +23 -0
  213. selenium/webdriver/remote/command.py +178 -0
  214. selenium/webdriver/remote/errorhandler.py +246 -0
  215. selenium/webdriver/remote/file_detector.py +61 -0
  216. selenium/webdriver/remote/findElements.js +122 -0
  217. selenium/webdriver/remote/getAttribute.js +100 -0
  218. selenium/webdriver/remote/isDisplayed.js +100 -0
  219. selenium/webdriver/remote/mobile.py +86 -0
  220. selenium/webdriver/remote/remote_connection.py +471 -0
  221. selenium/webdriver/remote/script_key.py +30 -0
  222. selenium/webdriver/remote/switch_to.py +154 -0
  223. selenium/webdriver/remote/utils.py +27 -0
  224. selenium/webdriver/remote/webdriver.py +1597 -0
  225. selenium/webdriver/remote/webelement.py +768 -0
  226. selenium/webdriver/safari/__init__.py +16 -0
  227. selenium/webdriver/safari/options.py +99 -0
  228. selenium/webdriver/safari/permissions.py +28 -0
  229. selenium/webdriver/safari/remote_connection.py +31 -0
  230. selenium/webdriver/safari/service.py +64 -0
  231. selenium/webdriver/safari/webdriver.py +145 -0
  232. selenium/webdriver/support/__init__.py +16 -0
  233. selenium/webdriver/support/abstract_event_listener.py +79 -0
  234. selenium/webdriver/support/color.py +331 -0
  235. selenium/webdriver/support/event_firing_webdriver.py +362 -0
  236. selenium/webdriver/support/events.py +19 -0
  237. selenium/webdriver/support/expected_conditions.py +470 -0
  238. selenium/webdriver/support/relative_locator.py +155 -0
  239. selenium/webdriver/support/select.py +241 -0
  240. selenium/webdriver/support/ui.py +19 -0
  241. selenium/webdriver/support/wait.py +110 -0
  242. selenium/webdriver/webkitgtk/__init__.py +16 -0
  243. selenium/webdriver/webkitgtk/options.py +95 -0
  244. selenium/webdriver/webkitgtk/service.py +42 -0
  245. selenium/webdriver/webkitgtk/webdriver.py +78 -0
  246. selenium/webdriver/wpewebkit/__init__.py +16 -0
  247. selenium/webdriver/wpewebkit/options.py +70 -0
  248. selenium/webdriver/wpewebkit/service.py +42 -0
  249. selenium/webdriver/wpewebkit/webdriver.py +72 -0
  250. selenium-4.0.0.rc1.dist-info/METADATA +169 -0
  251. selenium-4.0.0.rc1.dist-info/RECORD +252 -0
  252. selenium-4.0.0.rc1.dist-info/WHEEL +4 -0
selenium/__init__.py ADDED
@@ -0,0 +1,19 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+
19
+ __version__ = "4.0.0.rc1"
@@ -0,0 +1,18 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ from . import exceptions # noqa
@@ -0,0 +1,317 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ """
19
+ Exceptions that may happen in all the webdriver code.
20
+ """
21
+
22
+ from typing import Optional, Sequence
23
+
24
+
25
+ class WebDriverException(Exception):
26
+ """
27
+ Base webdriver exception.
28
+ """
29
+
30
+ def __init__(self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None) -> None:
31
+ self.msg = msg
32
+ self.screen = screen
33
+ self.stacktrace = stacktrace
34
+
35
+ def __str__(self) -> str:
36
+ exception_msg = "Message: %s\n" % self.msg
37
+ if self.screen:
38
+ exception_msg += "Screenshot: available via screen\n"
39
+ if self.stacktrace:
40
+ stacktrace = "\n".join(self.stacktrace)
41
+ exception_msg += "Stacktrace:\n%s" % stacktrace
42
+ return exception_msg
43
+
44
+
45
+ class InvalidSwitchToTargetException(WebDriverException):
46
+ """
47
+ Thrown when frame or window target to be switched doesn't exist.
48
+ """
49
+ pass
50
+
51
+
52
+ class NoSuchFrameException(InvalidSwitchToTargetException):
53
+ """
54
+ Thrown when frame target to be switched doesn't exist.
55
+ """
56
+ pass
57
+
58
+
59
+ class NoSuchWindowException(InvalidSwitchToTargetException):
60
+ """
61
+ Thrown when window target to be switched doesn't exist.
62
+
63
+ To find the current set of active window handles, you can get a list
64
+ of the active window handles in the following way::
65
+
66
+ print driver.window_handles
67
+
68
+ """
69
+ pass
70
+
71
+
72
+ class NoSuchElementException(WebDriverException):
73
+ """
74
+ Thrown when element could not be found.
75
+
76
+ If you encounter this exception, you may want to check the following:
77
+ * Check your selector used in your find_by...
78
+ * Element may not yet be on the screen at the time of the find operation,
79
+ (webpage is still loading) see selenium.webdriver.support.wait.WebDriverWait()
80
+ for how to write a wait wrapper to wait for an element to appear.
81
+ """
82
+ pass
83
+
84
+
85
+ class NoSuchAttributeException(WebDriverException):
86
+ """
87
+ Thrown when the attribute of element could not be found.
88
+
89
+ You may want to check if the attribute exists in the particular browser you are
90
+ testing against. Some browsers may have different property names for the same
91
+ property. (IE8's .innerText vs. Firefox .textContent)
92
+ """
93
+ pass
94
+
95
+
96
+ class StaleElementReferenceException(WebDriverException):
97
+ """
98
+ Thrown when a reference to an element is now "stale".
99
+
100
+ Stale means the element no longer appears on the DOM of the page.
101
+
102
+
103
+ Possible causes of StaleElementReferenceException include, but not limited to:
104
+ * You are no longer on the same page, or the page may have refreshed since the element
105
+ was located.
106
+ * The element may have been removed and re-added to the screen, since it was located.
107
+ Such as an element being relocated.
108
+ This can happen typically with a javascript framework when values are updated and the
109
+ node is rebuilt.
110
+ * Element may have been inside an iframe or another context which was refreshed.
111
+ """
112
+ pass
113
+
114
+
115
+ class InvalidElementStateException(WebDriverException):
116
+ """
117
+ Thrown when a command could not be completed because the element is in an invalid state.
118
+
119
+ This can be caused by attempting to clear an element that isn't both editable and resettable.
120
+ """
121
+ pass
122
+
123
+
124
+ class UnexpectedAlertPresentException(WebDriverException):
125
+ """
126
+ Thrown when an unexpected alert has appeared.
127
+
128
+ Usually raised when an unexpected modal is blocking the webdriver from executing
129
+ commands.
130
+ """
131
+ def __init__(self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None, alert_text: Optional[str] = None) -> None:
132
+ super(UnexpectedAlertPresentException, self).__init__(msg, screen, stacktrace)
133
+ self.alert_text = alert_text
134
+
135
+ def __str__(self) -> str:
136
+ return "Alert Text: %s\n%s" % (self.alert_text, super(UnexpectedAlertPresentException, self).__str__())
137
+
138
+
139
+ class NoAlertPresentException(WebDriverException):
140
+ """
141
+ Thrown when switching to no presented alert.
142
+
143
+ This can be caused by calling an operation on the Alert() class when an alert is
144
+ not yet on the screen.
145
+ """
146
+ pass
147
+
148
+
149
+ class ElementNotVisibleException(InvalidElementStateException):
150
+ """
151
+ Thrown when an element is present on the DOM, but
152
+ it is not visible, and so is not able to be interacted with.
153
+
154
+ Most commonly encountered when trying to click or read text
155
+ of an element that is hidden from view.
156
+ """
157
+ pass
158
+
159
+
160
+ class ElementNotInteractableException(InvalidElementStateException):
161
+ """
162
+ Thrown when an element is present in the DOM but interactions
163
+ with that element will hit another element due to paint order
164
+ """
165
+ pass
166
+
167
+
168
+ class ElementNotSelectableException(InvalidElementStateException):
169
+ """
170
+ Thrown when trying to select an unselectable element.
171
+
172
+ For example, selecting a 'script' element.
173
+ """
174
+ pass
175
+
176
+
177
+ class InvalidCookieDomainException(WebDriverException):
178
+ """
179
+ Thrown when attempting to add a cookie under a different domain
180
+ than the current URL.
181
+ """
182
+ pass
183
+
184
+
185
+ class UnableToSetCookieException(WebDriverException):
186
+ """
187
+ Thrown when a driver fails to set a cookie.
188
+ """
189
+ pass
190
+
191
+
192
+ class RemoteDriverServerException(WebDriverException):
193
+ """
194
+ """
195
+ pass
196
+
197
+
198
+ class TimeoutException(WebDriverException):
199
+ """
200
+ Thrown when a command does not complete in enough time.
201
+ """
202
+ pass
203
+
204
+
205
+ class MoveTargetOutOfBoundsException(WebDriverException):
206
+ """
207
+ Thrown when the target provided to the `ActionsChains` move()
208
+ method is invalid, i.e. out of document.
209
+ """
210
+ pass
211
+
212
+
213
+ class UnexpectedTagNameException(WebDriverException):
214
+ """
215
+ Thrown when a support class did not get an expected web element.
216
+ """
217
+ pass
218
+
219
+
220
+ class InvalidSelectorException(NoSuchElementException):
221
+ """
222
+ Thrown when the selector which is used to find an element does not return
223
+ a WebElement. Currently this only happens when the selector is an xpath
224
+ expression and it is either syntactically invalid (i.e. it is not a
225
+ xpath expression) or the expression does not select WebElements
226
+ (e.g. "count(//input)").
227
+ """
228
+ pass
229
+
230
+
231
+ class ImeNotAvailableException(WebDriverException):
232
+ """
233
+ Thrown when IME support is not available. This exception is thrown for every IME-related
234
+ method call if IME support is not available on the machine.
235
+ """
236
+ pass
237
+
238
+
239
+ class ImeActivationFailedException(WebDriverException):
240
+ """
241
+ Thrown when activating an IME engine has failed.
242
+ """
243
+ pass
244
+
245
+
246
+ class InvalidArgumentException(WebDriverException):
247
+ """
248
+ The arguments passed to a command are either invalid or malformed.
249
+ """
250
+ pass
251
+
252
+
253
+ class JavascriptException(WebDriverException):
254
+ """
255
+ An error occurred while executing JavaScript supplied by the user.
256
+ """
257
+ pass
258
+
259
+
260
+ class NoSuchCookieException(WebDriverException):
261
+ """
262
+ No cookie matching the given path name was found amongst the associated cookies of the
263
+ current browsing context's active document.
264
+ """
265
+ pass
266
+
267
+
268
+ class ScreenshotException(WebDriverException):
269
+ """
270
+ A screen capture was made impossible.
271
+ """
272
+ pass
273
+
274
+
275
+ class ElementClickInterceptedException(WebDriverException):
276
+ """
277
+ The Element Click command could not be completed because the element receiving the events
278
+ is obscuring the element that was requested to be clicked.
279
+ """
280
+ pass
281
+
282
+
283
+ class InsecureCertificateException(WebDriverException):
284
+ """
285
+ Navigation caused the user agent to hit a certificate warning, which is usually the result
286
+ of an expired or invalid TLS certificate.
287
+ """
288
+ pass
289
+
290
+
291
+ class InvalidCoordinatesException(WebDriverException):
292
+ """
293
+ The coordinates provided to an interaction's operation are invalid.
294
+ """
295
+ pass
296
+
297
+
298
+ class InvalidSessionIdException(WebDriverException):
299
+ """
300
+ Occurs if the given session id is not in the list of active sessions, meaning the session
301
+ either does not exist or that it's not active.
302
+ """
303
+ pass
304
+
305
+
306
+ class SessionNotCreatedException(WebDriverException):
307
+ """
308
+ A new session could not be created.
309
+ """
310
+ pass
311
+
312
+
313
+ class UnknownMethodException(WebDriverException):
314
+ """
315
+ The requested command matched a known URL but did not match any methods for that URL.
316
+ """
317
+ pass
selenium/types.py ADDED
@@ -0,0 +1,23 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ """Selenium type definitions."""
19
+
20
+ from typing import Union
21
+
22
+
23
+ AnyKey = Union[str, int, float]
@@ -0,0 +1,41 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ from .firefox.webdriver import WebDriver as Firefox # noqa
19
+ from .firefox.firefox_profile import FirefoxProfile # noqa
20
+ from .firefox.options import Options as FirefoxOptions # noqa
21
+ from .chrome.webdriver import WebDriver as Chrome # noqa
22
+ from .chrome.options import Options as ChromeOptions # noqa
23
+ from .ie.webdriver import WebDriver as Ie # noqa
24
+ from .ie.options import Options as IeOptions # noqa
25
+ from .edge.webdriver import WebDriver as Edge # noqa
26
+ from .edge.webdriver import WebDriver as ChromiumEdge # noqa
27
+ from .edge.options import Options as EdgeOptions # noqa
28
+ from .opera.webdriver import WebDriver as Opera # noqa
29
+ from .safari.webdriver import WebDriver as Safari # noqa
30
+ from .webkitgtk.webdriver import WebDriver as WebKitGTK # noqa
31
+ from .webkitgtk.options import Options as WebKitGTKOptions # noqa
32
+ from .wpewebkit.webdriver import WebDriver as WPEWebKit # noqa
33
+ from .wpewebkit.options import Options as WPEWebKitOptions # noqa
34
+ from .remote.webdriver import WebDriver as Remote # noqa
35
+ from .common.desired_capabilities import DesiredCapabilities # noqa
36
+ from .common.action_chains import ActionChains # noqa
37
+ from .common.touch_actions import TouchActions # noqa
38
+ from .common.proxy import Proxy # noqa
39
+ from .common.keys import Keys # noqa
40
+
41
+ __version__ = '4.0.0.rc1'
@@ -0,0 +1,16 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
@@ -0,0 +1,29 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ from selenium.webdriver.chromium.options import ChromiumOptions
19
+ from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
20
+
21
+
22
+ class Options(ChromiumOptions):
23
+
24
+ @property
25
+ def default_capabilities(self) -> dict:
26
+ return DesiredCapabilities.CHROME.copy()
27
+
28
+ def enable_mobile(self, android_package="com.android.chrome", android_activity=None, device_serial=None):
29
+ super().enable_mobile(android_package, android_activity, device_serial)
@@ -0,0 +1,44 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ from typing import List
19
+ from selenium.webdriver.chromium import service
20
+
21
+
22
+ class Service(service.ChromiumService):
23
+ """
24
+ Object that manages the starting and stopping of the ChromeDriver
25
+ """
26
+
27
+ def __init__(self, executable_path: str, port: int = 0, service_args: List[str] = None,
28
+ log_path: str = None, env: str = None):
29
+ """
30
+ Creates a new instance of the Service
31
+
32
+ :Args:
33
+ - executable_path : Path to the ChromeDriver
34
+ - port : Port the service is running on
35
+ - service_args : List of args to pass to the chromedriver service
36
+ - log_path : Path for the chromedriver service to log to"""
37
+
38
+ super(Service, self).__init__(
39
+ executable_path,
40
+ port,
41
+ service_args,
42
+ log_path,
43
+ env,
44
+ "Please see https://chromedriver.chromium.org/home")
@@ -0,0 +1,72 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ import warnings
18
+ from selenium.webdriver.chromium.webdriver import ChromiumDriver
19
+ from .options import Options
20
+ from .service import Service
21
+ from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
22
+
23
+
24
+ DEFAULT_PORT = 0
25
+ DEFAULT_SERVICE_LOG_PATH = None
26
+ DEFAULT_KEEP_ALIVE = None
27
+
28
+
29
+ class WebDriver(ChromiumDriver):
30
+ """
31
+ Controls the ChromeDriver and allows you to drive the browser.
32
+ You will need to download the ChromeDriver executable from
33
+ http://chromedriver.storage.googleapis.com/index.html
34
+ """
35
+
36
+ def __init__(self, executable_path="chromedriver", port=DEFAULT_PORT,
37
+ options: Options = None, service_args=None,
38
+ desired_capabilities=None, service_log_path=DEFAULT_SERVICE_LOG_PATH,
39
+ chrome_options=None, service: Service = None, keep_alive=DEFAULT_KEEP_ALIVE):
40
+ """
41
+ Creates a new instance of the chrome driver.
42
+ Starts the service and then creates new instance of chrome driver.
43
+
44
+ :Args:
45
+ - executable_path - Deprecated: path to the executable. If the default is used it assumes the executable is in the $PATH
46
+ - port - Deprecated: port you would like the service to run, if left as 0, a free port will be found.
47
+ - options - this takes an instance of ChromeOptions
48
+ - service_args - Deprecated: List of args to pass to the driver service
49
+ - desired_capabilities - Deprecated: Dictionary object with non-browser specific
50
+ capabilities only, such as "proxy" or "loggingPref".
51
+ - service_log_path - Deprecated: Where to log information from the driver.
52
+ - keep_alive - Deprecated: Whether to configure ChromeRemoteConnection to use HTTP keep-alive.
53
+ """
54
+ if executable_path != 'chromedriver':
55
+ warnings.warn('executable_path has been deprecated, please pass in a Service object',
56
+ DeprecationWarning, stacklevel=2)
57
+ if chrome_options:
58
+ warnings.warn('use options instead of chrome_options',
59
+ DeprecationWarning, stacklevel=2)
60
+ options = chrome_options
61
+ if keep_alive != DEFAULT_KEEP_ALIVE:
62
+ warnings.warn('keep_alive has been deprecated, please pass in a Service object',
63
+ DeprecationWarning, stacklevel=2)
64
+ else:
65
+ keep_alive = True
66
+ if not service:
67
+ service = Service(executable_path, port, service_args, service_log_path)
68
+
69
+ super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
70
+ port, options,
71
+ service_args, desired_capabilities,
72
+ service_log_path, service, keep_alive)
@@ -0,0 +1,16 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.