MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / highlight_element_with_js

Function highlight_element_with_js

seleniumbase/fixtures/js_utils.py:523–594  ·  view source on GitHub ↗
(driver, element, loops=4, o_bs="")

Source from the content-addressed store, hash-verified

521
522
523def highlight_element_with_js(driver, element, loops=4, o_bs=""):
524 with suppress(Exception):
525 # This closes any pop-up alerts
526 execute_script(driver, "")
527 script = (
528 """arguments[0].style.boxShadow =
529 '0px 0px 6px 6px rgba(128, 128, 128, 0.5)';"""
530 )
531 try:
532 execute_script(driver, script, element)
533 except Exception:
534 return
535 for n in range(loops):
536 script = (
537 """arguments[0].style.boxShadow =
538 '0px 0px 6px 6px rgba(255, 0, 0, 1)';"""
539 )
540 try:
541 execute_script(driver, script, element)
542 except Exception:
543 return
544 time.sleep(0.0181)
545 script = (
546 """arguments[0].style.boxShadow =
547 '0px 0px 6px 6px rgba(128, 0, 128, 1)';"""
548 )
549 try:
550 execute_script(driver, script, element)
551 except Exception:
552 return
553 time.sleep(0.0181)
554 script = (
555 """arguments[0].style.boxShadow =
556 '0px 0px 6px 6px rgba(0, 0, 255, 1)';"""
557 )
558 try:
559 execute_script(driver, script, element)
560 except Exception:
561 return
562 time.sleep(0.0181)
563 script = (
564 """arguments[0].style.boxShadow =
565 '0px 0px 6px 6px rgba(0, 255, 0, 1)';"""
566 )
567 try:
568 execute_script(driver, script, element)
569 except Exception:
570 return
571 time.sleep(0.0181)
572 script = (
573 """arguments[0].style.boxShadow =
574 '0px 0px 6px 6px rgba(128, 128, 0, 1)';"""
575 )
576 try:
577 execute_script(driver, script, element)
578 except Exception:
579 return
580 time.sleep(0.0181)

Callers 1

highlightFunction · 0.85

Calls 2

execute_scriptFunction · 0.85
sleepMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…