Skip to content

Commit 5f5dca8

Browse files
committed
Update tour logic
1 parent 3c714ef commit 5f5dca8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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:

0 commit comments

Comments
 (0)