Skip to content

Commit f1444b4

Browse files
authored
Merge pull request #1859 from seleniumbase/update-tours-and-mobile-mode
Update tours and mobile mode
2 parents 3c714ef + 9c28bf2 commit f1444b4

File tree

7 files changed

+831
-15
lines changed

7 files changed

+831
-15
lines changed

examples/presenter/edge_presentation.py

Lines changed: 798 additions & 0 deletions
Large diffs are not rendered by default.

examples/test_skype_site.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,3 @@ def test_skype_mobile_site(self):
3030
self.highlight_click('[data-bi-name="arrow-dropdown-mobile"]')
3131
self.highlight("#get-skype-0_android-download")
3232
self.highlight('[data-bi-id*="ios"]')
33-
self.highlight('[data-bi-id*="windows10"]')

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ certifi>=2022.12.7
1919
filelock>=3.4.1;python_version<"3.7"
2020
filelock>=3.12.0;python_version>="3.7"
2121
platformdirs>=2.4.0;python_version<"3.7"
22-
platformdirs>=3.4.0;python_version>="3.7"
22+
platformdirs>=3.5.0;python_version>="3.7"
2323
pyparsing>=3.0.7;python_version<"3.7"
2424
pyparsing>=3.0.9;python_version>="3.7"
2525
zipp==3.6.0;python_version<"3.7"
@@ -99,13 +99,13 @@ commonmark==0.9.1;python_version<"3.7"
9999
markdown-it-py==2.2.0;python_version>="3.7"
100100
mdurl==0.1.2;python_version>="3.7"
101101
rich==12.6.0;python_version<"3.7"
102-
rich==13.3.4;python_version>="3.7"
102+
rich==13.3.5;python_version>="3.7"
103103

104104
# --- Testing Requirements --- #
105105
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)
106106

107107
coverage==6.2;python_version<"3.7"
108-
coverage==7.2.3;python_version>="3.7"
108+
coverage==7.2.4;python_version>="3.7"
109109
pytest-cov==4.0.0
110110
flake8==5.0.4;python_version<"3.9"
111111
flake8==6.0.0;python_version>="3.9"

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.14.3"
2+
__version__ = "4.14.4"

seleniumbase/core/tour_helper.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def play_shepherd_tour(driver, tour_steps, msg_dur, name=None, interval=0):
263263
// Start the tour
264264
tour.start();
265265
$tour = tour;"""
266-
instructions += """
266+
extra = """
267267
document.body.addEventListener('keyup', function (event) {
268268
if (event.key === 'PageUp' || event.key === 'ArrowLeft') {
269269
Shepherd.activeTour.back(); }
@@ -278,6 +278,7 @@ def play_shepherd_tour(driver, tour_steps, msg_dur, name=None, interval=0):
278278
interval = 0.5
279279

280280
if not is_shepherd_activated(driver):
281+
instructions += extra
281282
activate_shepherd(driver)
282283

283284
if len(tour_steps[name]) > 1:
@@ -509,7 +510,7 @@ def play_driverjs_tour(
509510
// Start the tour!
510511
tour.start();
511512
$tour = tour;"""
512-
instructions += """
513+
extra = """
513514
document.body.addEventListener('keyup', function (event) {
514515
if (event.key === 'PageUp') { $tour.movePrevious(); }
515516
if (event.key === 'PageDown') { $tour.moveNext(); }
@@ -522,6 +523,7 @@ def play_driverjs_tour(
522523
interval = 0.5
523524

524525
if not is_driverjs_activated(driver):
526+
instructions += extra
525527
activate_driverjs(driver)
526528

527529
if len(tour_steps[name]) > 1:
@@ -641,7 +643,7 @@ def play_hopscotch_tour(
641643
// Start the tour!
642644
hopscotch.startTour(tour);
643645
$tour = hopscotch;"""
644-
instructions += """
646+
extra = """
645647
document.body.addEventListener('keyup', function (event) {
646648
if (event.key === 'PageUp' || event.key === 'ArrowLeft') {
647649
$tour.prevStep(); }
@@ -656,6 +658,7 @@ def play_hopscotch_tour(
656658
interval = 0.5
657659

658660
if not is_hopscotch_activated(driver):
661+
instructions += extra
659662
activate_hopscotch(driver)
660663

661664
if len(tour_steps[name]) > 1:
@@ -790,7 +793,7 @@ def play_introjs_tour(
790793
// Start the tour
791794
startIntro();
792795
"""
793-
instructions += """
796+
extra = """
794797
document.body.addEventListener('keyup', function (event) {
795798
if (event.key === 'PageUp') { $tour.previousStep(); }
796799
if (event.key === 'PageDown') { $tour.nextStep(); }
@@ -803,6 +806,7 @@ def play_introjs_tour(
803806
interval = 0.5
804807

805808
if not is_introjs_activated(driver):
809+
instructions += extra
806810
activate_introjs(driver)
807811

808812
if len(tour_steps[name]) > 1:

seleniumbase/fixtures/base_case.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3155,16 +3155,19 @@ def safe_execute_script(self, script, *args, **kwargs):
31553155

31563156
def set_window_rect(self, x, y, width, height):
31573157
self.__check_scope()
3158+
self.__check_browser()
31583159
self.driver.set_window_rect(x, y, width, height)
31593160
self.__demo_mode_pause_if_active()
31603161

31613162
def set_window_size(self, width, height):
31623163
self.__check_scope()
3164+
self.__check_browser()
31633165
self.driver.set_window_size(width, height)
31643166
self.__demo_mode_pause_if_active()
31653167

31663168
def maximize_window(self):
31673169
self.__check_scope()
3170+
self.__check_browser()
31683171
self.driver.maximize_window()
31693172
self.__demo_mode_pause_if_active()
31703173

@@ -3763,6 +3766,13 @@ def get_new_driver(
37633766
d_height = self.__device_height
37643767
if d_p_r is None:
37653768
d_p_r = self.__device_pixel_ratio
3769+
if is_mobile and not user_agent:
3770+
# Use the Pixel 4 user agent by default if not specified
3771+
user_agent = (
3772+
"Mozilla/5.0 (Linux; Android 11; Pixel 4 XL) "
3773+
"AppleWebKit/537.36 (KHTML, like Gecko) "
3774+
"Chrome/89.0.4389.105 Mobile Safari/537.36"
3775+
)
37663776
valid_browsers = constants.ValidBrowsers.valid_browsers
37673777
if browser_name not in valid_browsers:
37683778
raise Exception(
@@ -9367,6 +9377,11 @@ def quit_extra_driver(self, driver=None):
93679377
# If the driver to quit was the active driver, switch drivers
93689378
if driver == self.driver:
93699379
self.switch_to_default_driver()
9380+
try:
9381+
self.__check_browser()
9382+
except Exception:
9383+
self._default_driver = self._drivers_list[-1]
9384+
self.switch_to_default_driver()
93709385

93719386
############
93729387

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
'filelock>=3.4.1;python_version<"3.7"',
144144
'filelock>=3.12.0;python_version>="3.7"',
145145
'platformdirs>=2.4.0;python_version<"3.7"',
146-
'platformdirs>=3.4.0;python_version>="3.7"',
146+
'platformdirs>=3.5.0;python_version>="3.7"',
147147
'pyparsing>=3.0.7;python_version<"3.7"',
148148
'pyparsing>=3.0.9;python_version>="3.7"',
149149
'zipp==3.6.0;python_version<"3.7"',
@@ -223,25 +223,25 @@
223223
'markdown-it-py==2.2.0;python_version>="3.7"', # For new "rich"
224224
'mdurl==0.1.2;python_version>="3.7"', # For new "rich"
225225
'rich==12.6.0;python_version<"3.7"',
226-
'rich==13.3.4;python_version>="3.7"',
226+
'rich==13.3.5;python_version>="3.7"',
227227
],
228228
extras_require={
229229
# pip install -e .[allure]
230230
# Usage: pytest --alluredir=allure_results
231231
# Serve: allure serve allure_results
232232
"allure": [
233233
'allure-pytest==2.9.45;python_version<"3.7"',
234-
'allure-pytest==2.13.1;python_version>="3.7"',
234+
'allure-pytest==2.13.2;python_version>="3.7"',
235235
'allure-python-commons==2.9.45;python_version<"3.7"',
236-
'allure-python-commons==2.13.1;python_version>="3.7"',
236+
'allure-python-commons==2.13.2;python_version>="3.7"',
237237
'allure-behave==2.9.45;python_version<"3.7"',
238-
'allure-behave==2.13.1;python_version>="3.7"',
238+
'allure-behave==2.13.2;python_version>="3.7"',
239239
],
240240
# pip install -e .[coverage]
241241
# Usage: coverage run -m pytest; coverage html; coverage report
242242
"coverage": [
243243
'coverage==6.2;python_version<"3.7"',
244-
'coverage==7.2.3;python_version>="3.7"',
244+
'coverage==7.2.4;python_version>="3.7"',
245245
"pytest-cov==4.0.0",
246246
],
247247
# pip install -e .[flake8]

0 commit comments

Comments
 (0)