seleniumbase 4.43.0__py3-none-any.whl → 4.43.2__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 seleniumbase might be problematic. Click here for more details.
- seleniumbase/__version__.py +1 -1
- seleniumbase/behave/behave_sb.py +7 -8
- seleniumbase/console_scripts/sb_caseplans.py +3 -4
- seleniumbase/console_scripts/sb_mkchart.py +1 -2
- seleniumbase/console_scripts/sb_mkdir.py +21 -22
- seleniumbase/console_scripts/sb_mkfile.py +1 -2
- seleniumbase/console_scripts/sb_mkpres.py +1 -2
- seleniumbase/console_scripts/sb_mkrec.py +1 -2
- seleniumbase/console_scripts/sb_objectify.py +4 -5
- seleniumbase/console_scripts/sb_print.py +1 -1
- seleniumbase/core/browser_launcher.py +14 -3
- seleniumbase/core/detect_b_ver.py +214 -8
- seleniumbase/core/log_helper.py +4 -5
- seleniumbase/core/report_helper.py +6 -5
- seleniumbase/core/sb_cdp.py +17 -2
- seleniumbase/core/tour_helper.py +1 -2
- seleniumbase/fixtures/base_case.py +23 -24
- seleniumbase/fixtures/constants.py +11 -0
- seleniumbase/fixtures/js_utils.py +14 -2
- seleniumbase/fixtures/page_actions.py +1 -2
- seleniumbase/fixtures/page_utils.py +15 -10
- seleniumbase/plugins/basic_test_info.py +2 -3
- seleniumbase/plugins/page_source.py +2 -3
- seleniumbase/plugins/pytest_plugin.py +23 -20
- seleniumbase/translate/translator.py +2 -3
- seleniumbase/undetected/cdp_driver/cdp_util.py +42 -38
- seleniumbase/undetected/cdp_driver/connection.py +1 -2
- seleniumbase/utilities/selenium_grid/download_selenium_server.py +1 -1
- seleniumbase/utilities/selenium_grid/grid_hub.py +1 -2
- seleniumbase/utilities/selenium_grid/grid_node.py +2 -3
- seleniumbase/utilities/selenium_ide/convert_ide.py +2 -3
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/METADATA +4 -3
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/RECORD +37 -37
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/WHEEL +0 -0
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/licenses/LICENSE +0 -0
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/top_level.txt +0 -0
|
@@ -40,6 +40,10 @@ class OSType(object):
|
|
|
40
40
|
class ChromeType(object):
|
|
41
41
|
GOOGLE = "google-chrome"
|
|
42
42
|
MSEDGE = "edge"
|
|
43
|
+
OPERA = "opera"
|
|
44
|
+
BRAVE = "brave"
|
|
45
|
+
COMET = "comet"
|
|
46
|
+
ATLAS = "atlas"
|
|
43
47
|
|
|
44
48
|
|
|
45
49
|
PATTERN = {
|
|
@@ -96,7 +100,9 @@ def linux_browser_apps_to_cmd(*apps):
|
|
|
96
100
|
)
|
|
97
101
|
|
|
98
102
|
|
|
99
|
-
def chrome_on_linux_path(chromium_ok=False):
|
|
103
|
+
def chrome_on_linux_path(chromium_ok=False, browser_type=None):
|
|
104
|
+
if browser_type and browser_type != ChromeType.GOOGLE:
|
|
105
|
+
return ""
|
|
100
106
|
if os_name() != OSType.LINUX:
|
|
101
107
|
return ""
|
|
102
108
|
paths = ["/bin/google-chrome", "/bin/google-chrome-stable"]
|
|
@@ -126,7 +132,9 @@ def chrome_on_linux_path(chromium_ok=False):
|
|
|
126
132
|
return "/usr/bin/google-chrome"
|
|
127
133
|
|
|
128
134
|
|
|
129
|
-
def edge_on_linux_path():
|
|
135
|
+
def edge_on_linux_path(browser_type=None):
|
|
136
|
+
if browser_type and browser_type != ChromeType.MSEDGE:
|
|
137
|
+
return ""
|
|
130
138
|
if os_name() != OSType.LINUX:
|
|
131
139
|
return ""
|
|
132
140
|
paths = os.environ["PATH"].split(os.pathsep)
|
|
@@ -143,7 +151,60 @@ def edge_on_linux_path():
|
|
|
143
151
|
return "/usr/bin/microsoft-edge"
|
|
144
152
|
|
|
145
153
|
|
|
146
|
-
def
|
|
154
|
+
def opera_on_linux_path(browser_type=None):
|
|
155
|
+
if browser_type and browser_type != ChromeType.OPERA:
|
|
156
|
+
return ""
|
|
157
|
+
if os_name() != OSType.LINUX:
|
|
158
|
+
return ""
|
|
159
|
+
paths = os.environ["PATH"].split(os.pathsep)
|
|
160
|
+
binaries = []
|
|
161
|
+
binaries.append("opera")
|
|
162
|
+
binaries.append("opera-stable")
|
|
163
|
+
for binary in binaries:
|
|
164
|
+
for path in paths:
|
|
165
|
+
full_path = os.path.join(path, binary)
|
|
166
|
+
if os.path.exists(full_path) and os.access(full_path, os.X_OK):
|
|
167
|
+
return full_path
|
|
168
|
+
return "/usr/bin/opera-stable"
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def brave_on_linux_path(browser_type=None):
|
|
172
|
+
if browser_type and browser_type != ChromeType.BRAVE:
|
|
173
|
+
return ""
|
|
174
|
+
if os_name() != OSType.LINUX:
|
|
175
|
+
return ""
|
|
176
|
+
paths = os.environ["PATH"].split(os.pathsep)
|
|
177
|
+
binaries = []
|
|
178
|
+
binaries.append("brave-browser")
|
|
179
|
+
binaries.append("brave")
|
|
180
|
+
binaries.append("brave-browser-stable")
|
|
181
|
+
for binary in binaries:
|
|
182
|
+
for path in paths:
|
|
183
|
+
full_path = os.path.join(path, binary)
|
|
184
|
+
if os.path.exists(full_path) and os.access(full_path, os.X_OK):
|
|
185
|
+
return full_path
|
|
186
|
+
return "/usr/bin/brave-browser"
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def comet_on_linux_path(browser_type=None):
|
|
190
|
+
if browser_type and browser_type != ChromeType.COMET:
|
|
191
|
+
return ""
|
|
192
|
+
if os_name() != OSType.LINUX:
|
|
193
|
+
return ""
|
|
194
|
+
return "" # Comet Browser isn't supported on Linux yet
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def atlas_on_linux_path(browser_type=None):
|
|
198
|
+
if browser_type and browser_type != ChromeType.ATLAS:
|
|
199
|
+
return ""
|
|
200
|
+
if os_name() != OSType.LINUX:
|
|
201
|
+
return ""
|
|
202
|
+
return "" # Atlas Browser isn't supported on Linux yet
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def chrome_on_windows_path(browser_type=None):
|
|
206
|
+
if browser_type and browser_type != ChromeType.GOOGLE:
|
|
207
|
+
return ""
|
|
147
208
|
if os_name() != OSType.WIN:
|
|
148
209
|
return ""
|
|
149
210
|
candidates = []
|
|
@@ -171,7 +232,9 @@ def chrome_on_windows_path():
|
|
|
171
232
|
return ""
|
|
172
233
|
|
|
173
234
|
|
|
174
|
-
def edge_on_windows_path():
|
|
235
|
+
def edge_on_windows_path(browser_type=None):
|
|
236
|
+
if browser_type and browser_type != ChromeType.MSEDGE:
|
|
237
|
+
return ""
|
|
175
238
|
if os_name() != OSType.WIN:
|
|
176
239
|
return ""
|
|
177
240
|
candidates = []
|
|
@@ -199,6 +262,119 @@ def edge_on_windows_path():
|
|
|
199
262
|
return ""
|
|
200
263
|
|
|
201
264
|
|
|
265
|
+
def opera_on_windows_path(browser_type=None):
|
|
266
|
+
if browser_type and browser_type != ChromeType.OPERA:
|
|
267
|
+
return ""
|
|
268
|
+
if os_name() != OSType.WIN:
|
|
269
|
+
return ""
|
|
270
|
+
candidates = []
|
|
271
|
+
for item in map(
|
|
272
|
+
os.environ.get,
|
|
273
|
+
(
|
|
274
|
+
"PROGRAMFILES",
|
|
275
|
+
"PROGRAMFILES(X86)",
|
|
276
|
+
"LOCALAPPDATA",
|
|
277
|
+
"PROGRAMW6432",
|
|
278
|
+
),
|
|
279
|
+
):
|
|
280
|
+
for subitem in (
|
|
281
|
+
"Opera",
|
|
282
|
+
"Opera/Application",
|
|
283
|
+
):
|
|
284
|
+
try:
|
|
285
|
+
candidates.append(os.sep.join((item, subitem, "launcher.exe")))
|
|
286
|
+
except TypeError:
|
|
287
|
+
pass
|
|
288
|
+
for candidate in candidates:
|
|
289
|
+
if os.path.exists(candidate) and os.access(candidate, os.X_OK):
|
|
290
|
+
return os.path.normpath(candidate)
|
|
291
|
+
return ""
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def brave_on_windows_path(browser_type=None):
|
|
295
|
+
if browser_type and browser_type != ChromeType.BRAVE:
|
|
296
|
+
return ""
|
|
297
|
+
if os_name() != OSType.WIN:
|
|
298
|
+
return ""
|
|
299
|
+
candidates = []
|
|
300
|
+
for item in map(
|
|
301
|
+
os.environ.get,
|
|
302
|
+
(
|
|
303
|
+
"PROGRAMFILES",
|
|
304
|
+
"PROGRAMFILES(X86)",
|
|
305
|
+
"LOCALAPPDATA",
|
|
306
|
+
"PROGRAMW6432",
|
|
307
|
+
),
|
|
308
|
+
):
|
|
309
|
+
for subitem in (
|
|
310
|
+
"BraveSoftware/Brave-Browser/Application",
|
|
311
|
+
):
|
|
312
|
+
try:
|
|
313
|
+
candidates.append(os.sep.join((item, subitem, "brave.exe")))
|
|
314
|
+
except TypeError:
|
|
315
|
+
pass
|
|
316
|
+
for candidate in candidates:
|
|
317
|
+
if os.path.exists(candidate) and os.access(candidate, os.X_OK):
|
|
318
|
+
return os.path.normpath(candidate)
|
|
319
|
+
return ""
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def comet_on_windows_path(browser_type=None):
|
|
323
|
+
if browser_type and browser_type != ChromeType.COMET:
|
|
324
|
+
return ""
|
|
325
|
+
if os_name() != OSType.WIN:
|
|
326
|
+
return ""
|
|
327
|
+
candidates = []
|
|
328
|
+
for item in map(
|
|
329
|
+
os.environ.get,
|
|
330
|
+
(
|
|
331
|
+
"PROGRAMFILES",
|
|
332
|
+
"PROGRAMFILES(X86)",
|
|
333
|
+
"LOCALAPPDATA",
|
|
334
|
+
"PROGRAMW6432",
|
|
335
|
+
),
|
|
336
|
+
):
|
|
337
|
+
for subitem in (
|
|
338
|
+
"Comet/Application",
|
|
339
|
+
):
|
|
340
|
+
try:
|
|
341
|
+
candidates.append(os.sep.join((item, subitem, "Comet.exe")))
|
|
342
|
+
except TypeError:
|
|
343
|
+
pass
|
|
344
|
+
for candidate in candidates:
|
|
345
|
+
if os.path.exists(candidate) and os.access(candidate, os.X_OK):
|
|
346
|
+
return os.path.normpath(candidate)
|
|
347
|
+
return ""
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def atlas_on_windows_path(browser_type=None):
|
|
351
|
+
if browser_type and browser_type != ChromeType.ATLAS:
|
|
352
|
+
return ""
|
|
353
|
+
if os_name() != OSType.WIN:
|
|
354
|
+
return ""
|
|
355
|
+
candidates = []
|
|
356
|
+
for item in map(
|
|
357
|
+
os.environ.get,
|
|
358
|
+
(
|
|
359
|
+
"PROGRAMFILES",
|
|
360
|
+
"PROGRAMFILES(X86)",
|
|
361
|
+
"LOCALAPPDATA",
|
|
362
|
+
"PROGRAMW6432",
|
|
363
|
+
),
|
|
364
|
+
):
|
|
365
|
+
for subitem in (
|
|
366
|
+
"Atlas/Application",
|
|
367
|
+
):
|
|
368
|
+
try:
|
|
369
|
+
candidates.append(os.sep.join((item, subitem, "Atlas.exe")))
|
|
370
|
+
except TypeError:
|
|
371
|
+
pass
|
|
372
|
+
for candidate in candidates:
|
|
373
|
+
if os.path.exists(candidate) and os.access(candidate, os.X_OK):
|
|
374
|
+
return os.path.normpath(candidate)
|
|
375
|
+
return ""
|
|
376
|
+
|
|
377
|
+
|
|
202
378
|
def windows_browser_apps_to_cmd(*apps):
|
|
203
379
|
"""Create analogue of browser --version command for windows."""
|
|
204
380
|
powershell = determine_powershell()
|
|
@@ -211,18 +387,48 @@ def windows_browser_apps_to_cmd(*apps):
|
|
|
211
387
|
|
|
212
388
|
def get_binary_location(browser_type, chromium_ok=False):
|
|
213
389
|
"""Return the full path of the browser binary."""
|
|
390
|
+
if browser_type.lower() == "chrome":
|
|
391
|
+
browser_type = "google-chrome"
|
|
392
|
+
elif browser_type.lower() == "msedge":
|
|
393
|
+
browser_type = "edge"
|
|
394
|
+
else:
|
|
395
|
+
browser_type = browser_type.lower()
|
|
214
396
|
cmd_mapping = {
|
|
215
397
|
ChromeType.GOOGLE: {
|
|
216
|
-
OSType.LINUX: chrome_on_linux_path(chromium_ok),
|
|
398
|
+
OSType.LINUX: chrome_on_linux_path(chromium_ok, browser_type),
|
|
217
399
|
OSType.MAC: r"/Applications/Google Chrome.app"
|
|
218
400
|
r"/Contents/MacOS/Google Chrome",
|
|
219
|
-
OSType.WIN: chrome_on_windows_path(),
|
|
401
|
+
OSType.WIN: chrome_on_windows_path(browser_type),
|
|
220
402
|
},
|
|
221
403
|
ChromeType.MSEDGE: {
|
|
222
|
-
OSType.LINUX: edge_on_linux_path(),
|
|
404
|
+
OSType.LINUX: edge_on_linux_path(browser_type),
|
|
223
405
|
OSType.MAC: r"/Applications/Microsoft Edge.app"
|
|
224
406
|
r"/Contents/MacOS/Microsoft Edge",
|
|
225
|
-
OSType.WIN: edge_on_windows_path(),
|
|
407
|
+
OSType.WIN: edge_on_windows_path(browser_type),
|
|
408
|
+
},
|
|
409
|
+
ChromeType.OPERA: {
|
|
410
|
+
OSType.LINUX: opera_on_linux_path(browser_type),
|
|
411
|
+
OSType.MAC: r"/Applications/Opera.app"
|
|
412
|
+
r"/Contents/MacOS/Opera",
|
|
413
|
+
OSType.WIN: opera_on_windows_path(browser_type),
|
|
414
|
+
},
|
|
415
|
+
ChromeType.BRAVE: {
|
|
416
|
+
OSType.LINUX: brave_on_linux_path(browser_type),
|
|
417
|
+
OSType.MAC: r"/Applications/Brave Browser.app"
|
|
418
|
+
r"/Contents/MacOS/Brave Browser",
|
|
419
|
+
OSType.WIN: brave_on_windows_path(browser_type),
|
|
420
|
+
},
|
|
421
|
+
ChromeType.COMET: {
|
|
422
|
+
OSType.LINUX: comet_on_linux_path(browser_type),
|
|
423
|
+
OSType.MAC: r"/Applications/Comet.app"
|
|
424
|
+
r"/Contents/MacOS/Comet",
|
|
425
|
+
OSType.WIN: comet_on_windows_path(browser_type),
|
|
426
|
+
},
|
|
427
|
+
ChromeType.ATLAS: {
|
|
428
|
+
OSType.LINUX: atlas_on_linux_path(browser_type),
|
|
429
|
+
OSType.MAC: r"/Applications/Atlas.app"
|
|
430
|
+
r"/Contents/MacOS/Atlas",
|
|
431
|
+
OSType.WIN: atlas_on_windows_path(browser_type),
|
|
226
432
|
},
|
|
227
433
|
}
|
|
228
434
|
return cmd_mapping[browser_type][os_name()]
|
seleniumbase/core/log_helper.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import codecs
|
|
2
1
|
import os
|
|
3
2
|
import shutil
|
|
4
3
|
import sys
|
|
@@ -37,7 +36,7 @@ def log_screenshot(test_logpath, driver, screenshot=None, get=False):
|
|
|
37
36
|
element = driver.find_element("tag name", "body")
|
|
38
37
|
screenshot = element.screenshot_as_base64
|
|
39
38
|
if screenshot != screenshot_warning:
|
|
40
|
-
with open(screenshot_path, "wb") as file:
|
|
39
|
+
with open(screenshot_path, mode="wb") as file:
|
|
41
40
|
file.write(screenshot)
|
|
42
41
|
with suppress(Exception):
|
|
43
42
|
shared_utils.make_writable(screenshot_path)
|
|
@@ -298,7 +297,7 @@ def log_test_failure_data(test, test_logpath, driver, browser, url=None):
|
|
|
298
297
|
with suppress(Exception):
|
|
299
298
|
os.makedirs(test_logpath)
|
|
300
299
|
with suppress(Exception):
|
|
301
|
-
log_file =
|
|
300
|
+
log_file = open(basic_file_path, mode="w+", encoding="utf-8")
|
|
302
301
|
log_file.writelines("\r\n".join(data_to_save))
|
|
303
302
|
log_file.close()
|
|
304
303
|
shared_utils.make_writable(basic_file_path)
|
|
@@ -353,7 +352,7 @@ def log_skipped_test_data(test, test_logpath, driver, browser, reason):
|
|
|
353
352
|
data_to_save.append("")
|
|
354
353
|
file_path = os.path.join(test_logpath, "skip_reason.txt")
|
|
355
354
|
with suppress(Exception):
|
|
356
|
-
log_file =
|
|
355
|
+
log_file = open(file_path, mode="w+", encoding="utf-8")
|
|
357
356
|
log_file.writelines("\r\n".join(data_to_save))
|
|
358
357
|
log_file.close()
|
|
359
358
|
shared_utils.make_writable(file_path)
|
|
@@ -388,7 +387,7 @@ def log_page_source(test_logpath, driver, source=None):
|
|
|
388
387
|
os.makedirs(test_logpath)
|
|
389
388
|
html_file_path = os.path.join(test_logpath, html_file_name)
|
|
390
389
|
with suppress(Exception):
|
|
391
|
-
html_file =
|
|
390
|
+
html_file = open(html_file_path, mode="w+", encoding="utf-8")
|
|
392
391
|
html_file.write(page_source)
|
|
393
392
|
html_file.close()
|
|
394
393
|
shared_utils.make_writable(html_file_path)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import codecs
|
|
2
1
|
import os
|
|
3
2
|
import shutil
|
|
4
3
|
import sys
|
|
@@ -48,7 +47,9 @@ def save_test_failure_data(test, name, folder=None):
|
|
|
48
47
|
failure_data_file_path = os.path.join(file_path, name)
|
|
49
48
|
else:
|
|
50
49
|
failure_data_file_path = name
|
|
51
|
-
failure_data_file =
|
|
50
|
+
failure_data_file = open(
|
|
51
|
+
failure_data_file_path, mode="w+", encoding="utf-8"
|
|
52
|
+
)
|
|
52
53
|
data_to_save = []
|
|
53
54
|
if not hasattr(sb_config, "_report_test_id"):
|
|
54
55
|
exc_message = "(Unknown Exception)"
|
|
@@ -100,7 +101,7 @@ def process_failures(test, test_count, duration):
|
|
|
100
101
|
bad_page_data = "failure_%s.txt" % test_count
|
|
101
102
|
screenshot_path = os.path.join(LATEST_REPORT_DIR, bad_page_image)
|
|
102
103
|
if hasattr(test, "_last_page_screenshot") and test._last_page_screenshot:
|
|
103
|
-
with open(screenshot_path, "wb") as file:
|
|
104
|
+
with open(screenshot_path, mode="wb") as file:
|
|
104
105
|
file.write(test._last_page_screenshot)
|
|
105
106
|
save_test_failure_data(test, bad_page_data, folder=LATEST_REPORT_DIR)
|
|
106
107
|
exc_message = None
|
|
@@ -173,7 +174,7 @@ def add_bad_page_log_file(page_results_list):
|
|
|
173
174
|
abs_path = os.path.abspath(".")
|
|
174
175
|
file_path = os.path.join(abs_path, LATEST_REPORT_DIR)
|
|
175
176
|
log_file = os.path.join(file_path, RESULTS_TABLE)
|
|
176
|
-
f = open(log_file, "w")
|
|
177
|
+
f = open(log_file, mode="w")
|
|
177
178
|
h_p1 = '"Num","Result","Stacktrace","Screenshot",'
|
|
178
179
|
h_p2 = '"URL","Browser","Epoch Time","Duration",'
|
|
179
180
|
h_p3 = '"Test Case Address","Additional Info"\n'
|
|
@@ -198,7 +199,7 @@ def add_results_page(html):
|
|
|
198
199
|
file_path = os.path.join(abs_path, LATEST_REPORT_DIR)
|
|
199
200
|
results_file_name = HTML_REPORT
|
|
200
201
|
results_file = os.path.join(file_path, results_file_name)
|
|
201
|
-
f = open(results_file, "w")
|
|
202
|
+
f = open(results_file, mode="w")
|
|
202
203
|
f.write(html)
|
|
203
204
|
f.close()
|
|
204
205
|
return results_file
|
seleniumbase/core/sb_cdp.py
CHANGED
|
@@ -1674,6 +1674,11 @@ class CDPMethods():
|
|
|
1674
1674
|
import pyautogui
|
|
1675
1675
|
pyautogui = self.__get_configured_pyautogui(pyautogui)
|
|
1676
1676
|
screen_width, screen_height = pyautogui.size()
|
|
1677
|
+
if (
|
|
1678
|
+
hasattr(sb_config, "_cdp_browser")
|
|
1679
|
+
and sb_config._cdp_browser == "opera"
|
|
1680
|
+
):
|
|
1681
|
+
x = x + 55
|
|
1677
1682
|
if x < 0 or y < 0 or x > screen_width or y > screen_height:
|
|
1678
1683
|
raise Exception(
|
|
1679
1684
|
"PyAutoGUI cannot click on point (%s, %s)"
|
|
@@ -1931,6 +1936,12 @@ class CDPMethods():
|
|
|
1931
1936
|
import pyautogui
|
|
1932
1937
|
pyautogui = self.__get_configured_pyautogui(pyautogui)
|
|
1933
1938
|
screen_width, screen_height = pyautogui.size()
|
|
1939
|
+
if (
|
|
1940
|
+
hasattr(sb_config, "_cdp_browser")
|
|
1941
|
+
and sb_config._cdp_browser == "opera"
|
|
1942
|
+
):
|
|
1943
|
+
x1 = x1 + 55
|
|
1944
|
+
x2 = x2 + 55
|
|
1934
1945
|
if x1 < 0 or y1 < 0 or x1 > screen_width or y1 > screen_height:
|
|
1935
1946
|
raise Exception(
|
|
1936
1947
|
"PyAutoGUI cannot drag-drop from point (%s, %s)"
|
|
@@ -2022,6 +2033,11 @@ class CDPMethods():
|
|
|
2022
2033
|
import pyautogui
|
|
2023
2034
|
pyautogui = self.__get_configured_pyautogui(pyautogui)
|
|
2024
2035
|
screen_width, screen_height = pyautogui.size()
|
|
2036
|
+
if (
|
|
2037
|
+
hasattr(sb_config, "_cdp_browser")
|
|
2038
|
+
and sb_config._cdp_browser == "opera"
|
|
2039
|
+
):
|
|
2040
|
+
x = x + 55
|
|
2025
2041
|
if x < 0 or y < 0 or x > screen_width or y > screen_height:
|
|
2026
2042
|
raise Exception(
|
|
2027
2043
|
"PyAutoGUI cannot hover on point (%s, %s)"
|
|
@@ -2669,7 +2685,6 @@ class CDPMethods():
|
|
|
2669
2685
|
self.loop.run_until_complete(self.page.wait())
|
|
2670
2686
|
|
|
2671
2687
|
def save_page_source(self, name, folder=None):
|
|
2672
|
-
import codecs
|
|
2673
2688
|
from seleniumbase.core import log_helper
|
|
2674
2689
|
if not name.endswith(".html"):
|
|
2675
2690
|
name = name + ".html"
|
|
@@ -2695,7 +2710,7 @@ class CDPMethods():
|
|
|
2695
2710
|
rendered_source = "%s\n%s" % (base_href_html, page_source)
|
|
2696
2711
|
else:
|
|
2697
2712
|
rendered_source = page_source
|
|
2698
|
-
html_file =
|
|
2713
|
+
html_file = open(html_file_path, mode="w+", encoding="utf-8")
|
|
2699
2714
|
html_file.write(rendered_source)
|
|
2700
2715
|
html_file.close()
|
|
2701
2716
|
|
seleniumbase/core/tour_helper.py
CHANGED
|
@@ -1134,10 +1134,9 @@ def export_tour(tour_steps, name=None, filename="my_tour.js", url=None):
|
|
|
1134
1134
|
os.makedirs(exported_tours_folder)
|
|
1135
1135
|
except Exception:
|
|
1136
1136
|
pass
|
|
1137
|
-
import codecs
|
|
1138
1137
|
|
|
1139
1138
|
file_path = exported_tours_folder + "/" + filename
|
|
1140
|
-
out_file =
|
|
1139
|
+
out_file = open(file_path, mode="w+", encoding="utf-8")
|
|
1141
1140
|
out_file.writelines(instructions)
|
|
1142
1141
|
out_file.close()
|
|
1143
1142
|
print("\n>>> [%s] was saved!\n" % file_path)
|
|
@@ -32,7 +32,6 @@ Improvements include making WebDriver more robust, reliable, and flexible.
|
|
|
32
32
|
Page elements are given enough time to load before WebDriver acts on them.
|
|
33
33
|
Code becomes greatly simplified and easier to maintain."""
|
|
34
34
|
|
|
35
|
-
import codecs
|
|
36
35
|
import colorama
|
|
37
36
|
import fasteners
|
|
38
37
|
import json
|
|
@@ -4683,7 +4682,7 @@ class BaseCase(unittest.TestCase):
|
|
|
4683
4682
|
if not os.path.exists(file_path):
|
|
4684
4683
|
os.makedirs(file_path)
|
|
4685
4684
|
cookies_file_path = os.path.join(file_path, name)
|
|
4686
|
-
cookies_file =
|
|
4685
|
+
cookies_file = open(cookies_file_path, "w+", encoding="utf-8")
|
|
4687
4686
|
cookies_file.writelines(json_cookies)
|
|
4688
4687
|
cookies_file.close()
|
|
4689
4688
|
|
|
@@ -5737,7 +5736,7 @@ class BaseCase(unittest.TestCase):
|
|
|
5737
5736
|
extra_file_name = "__init__.py"
|
|
5738
5737
|
extra_file_path = os.path.join(recordings_folder, extra_file_name)
|
|
5739
5738
|
if not os.path.exists(extra_file_path):
|
|
5740
|
-
out_file =
|
|
5739
|
+
out_file = open(extra_file_path, "w+", "utf-8")
|
|
5741
5740
|
out_file.writelines("\r\n".join(data))
|
|
5742
5741
|
out_file.close()
|
|
5743
5742
|
sys.stdout.write("\nCreated recordings%s__init__.py" % os.sep)
|
|
@@ -5785,7 +5784,7 @@ class BaseCase(unittest.TestCase):
|
|
|
5785
5784
|
extra_file_name = "pytest.ini"
|
|
5786
5785
|
extra_file_path = os.path.join(recordings_folder, extra_file_name)
|
|
5787
5786
|
if not os.path.exists(extra_file_path):
|
|
5788
|
-
out_file =
|
|
5787
|
+
out_file = open(extra_file_path, "w+", "utf-8")
|
|
5789
5788
|
out_file.writelines("\r\n".join(data))
|
|
5790
5789
|
out_file.close()
|
|
5791
5790
|
sys.stdout.write("\nCreated recordings%spytest.ini" % os.sep)
|
|
@@ -5806,7 +5805,7 @@ class BaseCase(unittest.TestCase):
|
|
|
5806
5805
|
extra_file_name = "setup.cfg"
|
|
5807
5806
|
extra_file_path = os.path.join(recordings_folder, extra_file_name)
|
|
5808
5807
|
if not os.path.exists(extra_file_path):
|
|
5809
|
-
out_file =
|
|
5808
|
+
out_file = open(extra_file_path, "w+", "utf-8")
|
|
5810
5809
|
out_file.writelines("\r\n".join(data))
|
|
5811
5810
|
out_file.close()
|
|
5812
5811
|
sys.stdout.write("\nCreated recordings%ssetup.cfg" % os.sep)
|
|
@@ -5824,7 +5823,7 @@ class BaseCase(unittest.TestCase):
|
|
|
5824
5823
|
elif context_filename:
|
|
5825
5824
|
file_name = context_filename
|
|
5826
5825
|
file_path = os.path.join(recordings_folder, file_name)
|
|
5827
|
-
out_file =
|
|
5826
|
+
out_file = open(file_path, "w+", "utf-8")
|
|
5828
5827
|
out_file.writelines("\r\n".join(data))
|
|
5829
5828
|
out_file.close()
|
|
5830
5829
|
rec_message = ">>> RECORDING SAVED as: "
|
|
@@ -5926,7 +5925,7 @@ class BaseCase(unittest.TestCase):
|
|
|
5926
5925
|
file_name = sb_config.behave_scenario.filename.replace(".", "_")
|
|
5927
5926
|
file_name = file_name.split("/")[-1].split("\\")[-1] + "_rec.feature"
|
|
5928
5927
|
file_path = os.path.join(features_folder, file_name)
|
|
5929
|
-
out_file =
|
|
5928
|
+
out_file = open(file_path, "w+", "utf-8")
|
|
5930
5929
|
out_file.writelines("\r\n".join(data))
|
|
5931
5930
|
out_file.close()
|
|
5932
5931
|
|
|
@@ -5964,7 +5963,7 @@ class BaseCase(unittest.TestCase):
|
|
|
5964
5963
|
file_name = "__init__.py"
|
|
5965
5964
|
file_path = os.path.join(features_folder, file_name)
|
|
5966
5965
|
if not os.path.exists(file_path):
|
|
5967
|
-
out_file =
|
|
5966
|
+
out_file = open(file_path, "w+", "utf-8")
|
|
5968
5967
|
out_file.writelines("\r\n".join(data))
|
|
5969
5968
|
out_file.close()
|
|
5970
5969
|
print("Created recordings/features/__init__.py")
|
|
@@ -5977,7 +5976,7 @@ class BaseCase(unittest.TestCase):
|
|
|
5977
5976
|
file_name = "behave.ini"
|
|
5978
5977
|
file_path = os.path.join(features_folder, file_name)
|
|
5979
5978
|
if not os.path.exists(file_path):
|
|
5980
|
-
out_file =
|
|
5979
|
+
out_file = open(file_path, "w+", "utf-8")
|
|
5981
5980
|
out_file.writelines("\r\n".join(data))
|
|
5982
5981
|
out_file.close()
|
|
5983
5982
|
print("Created recordings/features/behave.ini")
|
|
@@ -6016,7 +6015,7 @@ class BaseCase(unittest.TestCase):
|
|
|
6016
6015
|
file_name = "environment.py"
|
|
6017
6016
|
file_path = os.path.join(features_folder, file_name)
|
|
6018
6017
|
if not os.path.exists(file_path):
|
|
6019
|
-
out_file =
|
|
6018
|
+
out_file = open(file_path, "w+", "utf-8")
|
|
6020
6019
|
out_file.writelines("\r\n".join(data))
|
|
6021
6020
|
out_file.close()
|
|
6022
6021
|
print("Created recordings/features/environment.py")
|
|
@@ -6026,7 +6025,7 @@ class BaseCase(unittest.TestCase):
|
|
|
6026
6025
|
file_name = "__init__.py"
|
|
6027
6026
|
file_path = os.path.join(steps_folder, file_name)
|
|
6028
6027
|
if not os.path.exists(file_path):
|
|
6029
|
-
out_file =
|
|
6028
|
+
out_file = open(file_path, "w+", "utf-8")
|
|
6030
6029
|
out_file.writelines("\r\n".join(data))
|
|
6031
6030
|
out_file.close()
|
|
6032
6031
|
print("Created recordings/features/steps/__init__.py")
|
|
@@ -6037,7 +6036,7 @@ class BaseCase(unittest.TestCase):
|
|
|
6037
6036
|
file_name = "imported.py"
|
|
6038
6037
|
file_path = os.path.join(steps_folder, file_name)
|
|
6039
6038
|
if not os.path.exists(file_path):
|
|
6040
|
-
out_file =
|
|
6039
|
+
out_file = open(file_path, "w+", "utf-8")
|
|
6041
6040
|
out_file.writelines("\r\n".join(data))
|
|
6042
6041
|
out_file.close()
|
|
6043
6042
|
print("Created recordings/features/steps/imported.py")
|
|
@@ -11078,7 +11077,7 @@ class BaseCase(unittest.TestCase):
|
|
|
11078
11077
|
return # Skip the rest when deferred visual asserts are used
|
|
11079
11078
|
the_html = visual_helper.get_sbs_html()
|
|
11080
11079
|
file_path = os.path.join(test_logpath, constants.SideBySide.HTML_FILE)
|
|
11081
|
-
out_file =
|
|
11080
|
+
out_file = open(file_path, "w+", encoding="utf-8")
|
|
11082
11081
|
out_file.writelines(the_html)
|
|
11083
11082
|
out_file.close()
|
|
11084
11083
|
|
|
@@ -11238,16 +11237,16 @@ class BaseCase(unittest.TestCase):
|
|
|
11238
11237
|
self.save_screenshot(
|
|
11239
11238
|
baseline_png, visual_baseline_path, selector="body"
|
|
11240
11239
|
)
|
|
11241
|
-
out_file =
|
|
11240
|
+
out_file = open(page_url_file, "w+", encoding="utf-8")
|
|
11242
11241
|
out_file.writelines(page_url)
|
|
11243
11242
|
out_file.close()
|
|
11244
|
-
out_file =
|
|
11243
|
+
out_file = open(level_1_file, "w+", encoding="utf-8")
|
|
11245
11244
|
out_file.writelines(json.dumps(level_1))
|
|
11246
11245
|
out_file.close()
|
|
11247
|
-
out_file =
|
|
11246
|
+
out_file = open(level_2_file, "w+", encoding="utf-8")
|
|
11248
11247
|
out_file.writelines(json.dumps(level_2))
|
|
11249
11248
|
out_file.close()
|
|
11250
|
-
out_file =
|
|
11249
|
+
out_file = open(level_3_file, "w+", encoding="utf-8")
|
|
11251
11250
|
out_file.writelines(json.dumps(level_3))
|
|
11252
11251
|
out_file.close()
|
|
11253
11252
|
|
|
@@ -11386,7 +11385,7 @@ class BaseCase(unittest.TestCase):
|
|
|
11386
11385
|
alpha_n_d_name = "".join([x if x.isalnum() else "_" for x in name])
|
|
11387
11386
|
side_by_side_name = "side_by_side_%s.html" % alpha_n_d_name
|
|
11388
11387
|
file_path = os.path.join(test_logpath, side_by_side_name)
|
|
11389
|
-
out_file =
|
|
11388
|
+
out_file = open(file_path, "w+", encoding="utf-8")
|
|
11390
11389
|
out_file.writelines(the_html)
|
|
11391
11390
|
out_file.close()
|
|
11392
11391
|
|
|
@@ -12071,7 +12070,7 @@ class BaseCase(unittest.TestCase):
|
|
|
12071
12070
|
with suppress(Exception):
|
|
12072
12071
|
os.makedirs(saved_presentations_folder)
|
|
12073
12072
|
file_path = os.path.join(saved_presentations_folder, filename)
|
|
12074
|
-
out_file =
|
|
12073
|
+
out_file = open(file_path, "w+", encoding="utf-8")
|
|
12075
12074
|
out_file.writelines(the_html)
|
|
12076
12075
|
out_file.close()
|
|
12077
12076
|
if self._output_file_saves:
|
|
@@ -12766,7 +12765,7 @@ class BaseCase(unittest.TestCase):
|
|
|
12766
12765
|
with suppress(Exception):
|
|
12767
12766
|
os.makedirs(saved_charts_folder)
|
|
12768
12767
|
file_path = os.path.join(saved_charts_folder, filename)
|
|
12769
|
-
out_file =
|
|
12768
|
+
out_file = open(file_path, "w+", encoding="utf-8")
|
|
12770
12769
|
out_file.writelines(the_html)
|
|
12771
12770
|
out_file.close()
|
|
12772
12771
|
if self._output_file_saves:
|
|
@@ -16048,7 +16047,7 @@ class BaseCase(unittest.TestCase):
|
|
|
16048
16047
|
test_id = test_id.replace(".py::", ".").replace("::", ".")
|
|
16049
16048
|
test_id = test_id.replace("/", ".").replace("\\", ".")
|
|
16050
16049
|
test_id = test_id.replace(" ", "_")
|
|
16051
|
-
# Linux filename length limit for `
|
|
16050
|
+
# Linux filename length limit for `open(filename)` = 255
|
|
16052
16051
|
# 255 - len("latest_logs/") - len("/basic_test_info.txt") = 223
|
|
16053
16052
|
if len(test_id) <= 223:
|
|
16054
16053
|
return test_id
|
|
@@ -16326,7 +16325,7 @@ class BaseCase(unittest.TestCase):
|
|
|
16326
16325
|
dash_pie = json.dumps(sb_config._saved_dashboard_pie)
|
|
16327
16326
|
dash_pie_loc = constants.Dashboard.DASH_PIE
|
|
16328
16327
|
pie_path = os.path.join(abs_path, dash_pie_loc)
|
|
16329
|
-
pie_file =
|
|
16328
|
+
pie_file = open(pie_path, "w+", encoding="utf-8")
|
|
16330
16329
|
pie_file.writelines(dash_pie)
|
|
16331
16330
|
pie_file.close()
|
|
16332
16331
|
DASH_PIE_PNG_1 = constants.Dashboard.get_dash_pie_1()
|
|
@@ -16486,7 +16485,7 @@ class BaseCase(unittest.TestCase):
|
|
|
16486
16485
|
)
|
|
16487
16486
|
abs_path = os.path.abspath(".")
|
|
16488
16487
|
file_path = os.path.join(abs_path, "dashboard.html")
|
|
16489
|
-
out_file =
|
|
16488
|
+
out_file = open(file_path, "w+", encoding="utf-8")
|
|
16490
16489
|
out_file.writelines(the_html)
|
|
16491
16490
|
out_file.close()
|
|
16492
16491
|
sb_config._dash_html = the_html
|
|
@@ -16499,7 +16498,7 @@ class BaseCase(unittest.TestCase):
|
|
|
16499
16498
|
dash_json = json.dumps((_results, _display_id, _rt, _tlp, d_stats))
|
|
16500
16499
|
dash_json_loc = constants.Dashboard.DASH_JSON
|
|
16501
16500
|
dash_jsonpath = os.path.join(abs_path, dash_json_loc)
|
|
16502
|
-
dash_json_file =
|
|
16501
|
+
dash_json_file = open(dash_jsonpath, "w+", encoding="utf-8")
|
|
16503
16502
|
dash_json_file.writelines(dash_json)
|
|
16504
16503
|
dash_json_file.close()
|
|
16505
16504
|
|
|
@@ -406,7 +406,14 @@ class ValidBinaries:
|
|
|
406
406
|
"brave",
|
|
407
407
|
"opera",
|
|
408
408
|
"opera-stable",
|
|
409
|
+
"comet",
|
|
410
|
+
"comet-browser",
|
|
411
|
+
"comet-stable",
|
|
412
|
+
"atlas",
|
|
413
|
+
"atlas-browser",
|
|
414
|
+
"atlas-stable",
|
|
409
415
|
"chrome.exe", # WSL (Windows Subsystem for Linux)
|
|
416
|
+
"chromium.exe", # WSL (Windows Subsystem for Linux)
|
|
410
417
|
]
|
|
411
418
|
valid_edge_binaries_on_linux = [
|
|
412
419
|
"microsoft-edge",
|
|
@@ -424,6 +431,8 @@ class ValidBinaries:
|
|
|
424
431
|
"Google Chrome Dev",
|
|
425
432
|
"Brave Browser",
|
|
426
433
|
"Opera",
|
|
434
|
+
"Comet",
|
|
435
|
+
"Atlas",
|
|
427
436
|
]
|
|
428
437
|
valid_edge_binaries_on_macos = [
|
|
429
438
|
"Microsoft Edge",
|
|
@@ -434,6 +443,8 @@ class ValidBinaries:
|
|
|
434
443
|
"chrome-headless-shell.exe",
|
|
435
444
|
"brave.exe",
|
|
436
445
|
"opera.exe",
|
|
446
|
+
"comet.exe",
|
|
447
|
+
"atlas.exe",
|
|
437
448
|
]
|
|
438
449
|
valid_edge_binaries_on_windows = [
|
|
439
450
|
"msedge.exe",
|