Skip to content

Commit 85d1a7f

Browse files
committed
Make sure highlighting isn't blocked by pop-up alerts
1 parent 725cd26 commit 85d1a7f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

seleniumbase/fixtures/js_utils.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ def wait_for_css_query_selector(
247247

248248

249249
def highlight_with_js(driver, selector, loops, o_bs):
250+
try:
251+
# This closes any pop-up alerts
252+
driver.execute_script("")
253+
except Exception:
254+
pass
250255
script = (
251256
"""document.querySelector('%s').style.boxShadow =
252257
'0px 0px 6px 6px rgba(128, 128, 128, 0.5)';"""
@@ -308,6 +313,11 @@ def highlight_with_js(driver, selector, loops, o_bs):
308313

309314

310315
def highlight_with_jquery(driver, selector, loops, o_bs):
316+
try:
317+
# This closes any pop-up alerts
318+
driver.execute_script("")
319+
except Exception:
320+
pass
311321
script = (
312322
"""jQuery('%s').css('box-shadow',
313323
'0px 0px 6px 6px rgba(128, 128, 128, 0.5)');"""
@@ -689,6 +699,11 @@ def post_messenger_error_message(driver, message, msg_dur):
689699

690700

691701
def highlight_with_js_2(driver, message, selector, o_bs, msg_dur):
702+
try:
703+
# This closes any pop-up alerts
704+
driver.execute_script("")
705+
except Exception:
706+
pass
692707
if selector == "html":
693708
selector = "body"
694709
script = (

0 commit comments

Comments
 (0)