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

Function highlight_with_js_2

seleniumbase/fixtures/js_utils.py:1023–1103  ·  view source on GitHub ↗
(driver, message, selector, o_bs, msg_dur)

Source from the content-addressed store, hash-verified

1021
1022
1023def highlight_with_js_2(driver, message, selector, o_bs, msg_dur):
1024 with suppress(Exception):
1025 # This closes any pop-up alerts
1026 execute_script(driver, "")
1027 if selector == "html":
1028 selector = "body"
1029 selector_no_spaces = selector.replace(" ", "")
1030 early_exit = False
1031 if '[style=\\"' in selector_no_spaces:
1032 if "box\\-shadow:" in selector:
1033 early_exit = True # Changing the box-shadow changes the selector
1034 elif '[style=\\"' in selector:
1035 selector = selector.replace('[style=\\"', '[style\\*=\\"')
1036 else:
1037 early_exit = True # Changing the box-shadow changes the selector
1038 if early_exit:
1039 with suppress(Exception):
1040 activate_jquery(driver)
1041 post_messenger_success_message(driver, message, msg_dur)
1042 return
1043 script = (
1044 """document.querySelector('%s').style.boxShadow =
1045 '0px 0px 6px 6px rgba(128, 128, 128, 0.5)';"""
1046 % selector
1047 )
1048 try:
1049 execute_script(driver, script)
1050 except Exception:
1051 return
1052 time.sleep(0.0181)
1053 script = (
1054 """document.querySelector('%s').style.boxShadow =
1055 '0px 0px 6px 6px rgba(205, 30, 0, 1)';"""
1056 % selector
1057 )
1058 try:
1059 execute_script(driver, script)
1060 except Exception:
1061 return
1062 time.sleep(0.0181)
1063 script = (
1064 """document.querySelector('%s').style.boxShadow =
1065 '0px 0px 6px 6px rgba(128, 0, 128, 1)';"""
1066 % selector
1067 )
1068 try:
1069 execute_script(driver, script)
1070 except Exception:
1071 return
1072 time.sleep(0.0181)
1073 script = (
1074 """document.querySelector('%s').style.boxShadow =
1075 '0px 0px 6px 6px rgba(50, 50, 128, 1)';"""
1076 % selector
1077 )
1078 try:
1079 execute_script(driver, script)
1080 except Exception:

Callers

nothing calls this directly

Calls 4

execute_scriptFunction · 0.85
activate_jqueryFunction · 0.85
sleepMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…