seleniumbase 4.24.11__py3-none-any.whl → 4.33.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sbase/__init__.py +1 -0
 - sbase/steps.py +7 -0
 - seleniumbase/__init__.py +16 -7
 - seleniumbase/__version__.py +1 -1
 - seleniumbase/behave/behave_sb.py +97 -32
 - seleniumbase/common/decorators.py +16 -7
 - seleniumbase/config/proxy_list.py +3 -3
 - seleniumbase/config/settings.py +4 -0
 - seleniumbase/console_scripts/logo_helper.py +47 -8
 - seleniumbase/console_scripts/run.py +345 -335
 - seleniumbase/console_scripts/sb_behave_gui.py +5 -12
 - seleniumbase/console_scripts/sb_caseplans.py +6 -13
 - seleniumbase/console_scripts/sb_commander.py +5 -12
 - seleniumbase/console_scripts/sb_install.py +62 -54
 - seleniumbase/console_scripts/sb_mkchart.py +13 -20
 - seleniumbase/console_scripts/sb_mkdir.py +11 -17
 - seleniumbase/console_scripts/sb_mkfile.py +69 -43
 - seleniumbase/console_scripts/sb_mkpres.py +13 -20
 - seleniumbase/console_scripts/sb_mkrec.py +88 -21
 - seleniumbase/console_scripts/sb_objectify.py +30 -30
 - seleniumbase/console_scripts/sb_print.py +5 -12
 - seleniumbase/console_scripts/sb_recorder.py +16 -11
 - seleniumbase/core/browser_launcher.py +1658 -221
 - seleniumbase/core/log_helper.py +42 -27
 - seleniumbase/core/mysql.py +1 -4
 - seleniumbase/core/proxy_helper.py +35 -30
 - seleniumbase/core/recorder_helper.py +24 -5
 - seleniumbase/core/sb_cdp.py +1951 -0
 - seleniumbase/core/sb_driver.py +162 -8
 - seleniumbase/core/settings_parser.py +6 -0
 - seleniumbase/core/style_sheet.py +10 -0
 - seleniumbase/extensions/recorder.zip +0 -0
 - seleniumbase/fixtures/base_case.py +1225 -614
 - seleniumbase/fixtures/constants.py +10 -1
 - seleniumbase/fixtures/js_utils.py +171 -144
 - seleniumbase/fixtures/page_actions.py +177 -13
 - seleniumbase/fixtures/page_utils.py +25 -53
 - seleniumbase/fixtures/shared_utils.py +97 -11
 - seleniumbase/js_code/active_css_js.py +1 -1
 - seleniumbase/js_code/recorder_js.py +1 -1
 - seleniumbase/plugins/base_plugin.py +2 -3
 - seleniumbase/plugins/driver_manager.py +340 -65
 - seleniumbase/plugins/pytest_plugin.py +276 -47
 - seleniumbase/plugins/sb_manager.py +412 -99
 - seleniumbase/plugins/selenium_plugin.py +122 -17
 - seleniumbase/translate/translator.py +0 -7
 - seleniumbase/undetected/__init__.py +59 -52
 - seleniumbase/undetected/cdp.py +0 -1
 - seleniumbase/undetected/cdp_driver/__init__.py +1 -0
 - seleniumbase/undetected/cdp_driver/_contradict.py +110 -0
 - seleniumbase/undetected/cdp_driver/browser.py +829 -0
 - seleniumbase/undetected/cdp_driver/cdp_util.py +458 -0
 - seleniumbase/undetected/cdp_driver/config.py +334 -0
 - seleniumbase/undetected/cdp_driver/connection.py +639 -0
 - seleniumbase/undetected/cdp_driver/element.py +1168 -0
 - seleniumbase/undetected/cdp_driver/tab.py +1323 -0
 - seleniumbase/undetected/dprocess.py +4 -7
 - seleniumbase/undetected/options.py +6 -8
 - seleniumbase/undetected/patcher.py +11 -13
 - seleniumbase/undetected/reactor.py +0 -1
 - seleniumbase/undetected/webelement.py +16 -3
 - {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/LICENSE +1 -1
 - {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/METADATA +299 -252
 - {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/RECORD +67 -69
 - {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/WHEEL +1 -1
 - sbase/ReadMe.txt +0 -2
 - seleniumbase/ReadMe.md +0 -25
 - seleniumbase/common/ReadMe.md +0 -71
 - seleniumbase/console_scripts/ReadMe.md +0 -731
 - seleniumbase/drivers/ReadMe.md +0 -27
 - seleniumbase/extensions/ReadMe.md +0 -12
 - seleniumbase/masterqa/ReadMe.md +0 -61
 - seleniumbase/resources/ReadMe.md +0 -31
 - seleniumbase/resources/favicon.ico +0 -0
 - seleniumbase/utilities/selenium_grid/ReadMe.md +0 -84
 - seleniumbase/utilities/selenium_ide/ReadMe.md +0 -111
 - {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/entry_points.txt +0 -0
 - {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/top_level.txt +0 -0
 
| 
         @@ -2,12 +2,22 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            import re
         
     | 
| 
       3 
3 
     | 
    
         
             
            import requests
         
     | 
| 
       4 
4 
     | 
    
         
             
            import time
         
     | 
| 
      
 5 
     | 
    
         
            +
            from contextlib import suppress
         
     | 
| 
       5 
6 
     | 
    
         
             
            from selenium.common.exceptions import NoSuchElementException
         
     | 
| 
       6 
7 
     | 
    
         
             
            from selenium.common.exceptions import WebDriverException
         
     | 
| 
      
 8 
     | 
    
         
            +
            from selenium.webdriver.common.by import By
         
     | 
| 
       7 
9 
     | 
    
         
             
            from seleniumbase import config as sb_config
         
     | 
| 
       8 
10 
     | 
    
         
             
            from seleniumbase.config import settings
         
     | 
| 
       9 
11 
     | 
    
         
             
            from seleniumbase.fixtures import constants
         
     | 
| 
       10 
12 
     | 
    
         
             
            from seleniumbase.fixtures import css_to_xpath
         
     | 
| 
      
 13 
     | 
    
         
            +
            from seleniumbase.fixtures import shared_utils
         
     | 
| 
      
 14 
     | 
    
         
            +
            from seleniumbase.fixtures import xpath_to_css
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            def execute_script(driver, script, *args, **kwargs):
         
     | 
| 
      
 18 
     | 
    
         
            +
                if shared_utils.is_cdp_swap_needed(driver):
         
     | 
| 
      
 19 
     | 
    
         
            +
                    return driver.cdp.evaluate(script)
         
     | 
| 
      
 20 
     | 
    
         
            +
                return driver.execute_script(script, *args, **kwargs)
         
     | 
| 
       11 
21 
     | 
    
         | 
| 
       12 
22 
     | 
    
         | 
| 
       13 
23 
     | 
    
         
             
            def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT):
         
     | 
| 
         @@ -21,22 +31,19 @@ def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT): 
     | 
|
| 
       21 
31 
     | 
    
         
             
                (Previously, tests would fail immediately if exceeding the timeout.)"""
         
     | 
| 
       22 
32 
     | 
    
         
             
                if hasattr(settings, "SKIP_JS_WAITS") and settings.SKIP_JS_WAITS:
         
     | 
| 
       23 
33 
     | 
    
         
             
                    return
         
     | 
| 
       24 
     | 
    
         
            -
                if sb_config.time_limit and not sb_config.recorder_mode:
         
     | 
| 
       25 
     | 
    
         
            -
                    from seleniumbase.fixtures import shared_utils
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
34 
     | 
    
         
             
                start_ms = time.time() * 1000.0
         
     | 
| 
       28 
35 
     | 
    
         
             
                stop_ms = start_ms + (timeout * 1000.0)
         
     | 
| 
       29 
36 
     | 
    
         
             
                for x in range(int(timeout * 10)):
         
     | 
| 
       30 
37 
     | 
    
         
             
                    if sb_config.time_limit and not sb_config.recorder_mode:
         
     | 
| 
       31 
38 
     | 
    
         
             
                        shared_utils.check_if_time_limit_exceeded()
         
     | 
| 
       32 
39 
     | 
    
         
             
                    try:
         
     | 
| 
       33 
     | 
    
         
            -
                        ready_state =  
     | 
| 
      
 40 
     | 
    
         
            +
                        ready_state = execute_script(driver, "return document.readyState;")
         
     | 
| 
       34 
41 
     | 
    
         
             
                    except WebDriverException:
         
     | 
| 
       35 
42 
     | 
    
         
             
                        # Bug fix for: [Permission denied to access property "document"]
         
     | 
| 
       36 
43 
     | 
    
         
             
                        time.sleep(0.03)
         
     | 
| 
       37 
44 
     | 
    
         
             
                        return True
         
     | 
| 
       38 
45 
     | 
    
         
             
                    if ready_state == "complete":
         
     | 
| 
       39 
     | 
    
         
            -
                        time.sleep(0. 
     | 
| 
      
 46 
     | 
    
         
            +
                        time.sleep(0.002)
         
     | 
| 
       40 
47 
     | 
    
         
             
                        return True
         
     | 
| 
       41 
48 
     | 
    
         
             
                    else:
         
     | 
| 
       42 
49 
     | 
    
         
             
                        now_ms = time.time() * 1000.0
         
     | 
| 
         @@ -46,7 +53,7 @@ def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT): 
     | 
|
| 
       46 
53 
     | 
    
         
             
                return False  # readyState stayed "interactive" (Not "complete")
         
     | 
| 
       47 
54 
     | 
    
         | 
| 
       48 
55 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
            def execute_async_script(driver, script, timeout=settings. 
     | 
| 
      
 56 
     | 
    
         
            +
            def execute_async_script(driver, script, timeout=settings.LARGE_TIMEOUT):
         
     | 
| 
       50 
57 
     | 
    
         
             
                driver.set_script_timeout(timeout)
         
     | 
| 
       51 
58 
     | 
    
         
             
                return driver.execute_async_script(script)
         
     | 
| 
       52 
59 
     | 
    
         | 
| 
         @@ -54,11 +61,17 @@ def execute_async_script(driver, script, timeout=settings.EXTREME_TIMEOUT): 
     | 
|
| 
       54 
61 
     | 
    
         
             
            def wait_for_angularjs(driver, timeout=settings.LARGE_TIMEOUT, **kwargs):
         
     | 
| 
       55 
62 
     | 
    
         
             
                if hasattr(settings, "SKIP_JS_WAITS") and settings.SKIP_JS_WAITS:
         
     | 
| 
       56 
63 
     | 
    
         
             
                    return
         
     | 
| 
       57 
     | 
    
         
            -
                 
     | 
| 
      
 64 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
      
 65 
     | 
    
         
            +
                    # This closes pop-up alerts
         
     | 
| 
      
 66 
     | 
    
         
            +
                    execute_script(driver, "")
         
     | 
| 
      
 67 
     | 
    
         
            +
                if (
         
     | 
| 
      
 68 
     | 
    
         
            +
                    (hasattr(driver, "_is_using_uc") and driver._is_using_uc)
         
     | 
| 
      
 69 
     | 
    
         
            +
                    or not settings.WAIT_FOR_ANGULARJS
         
     | 
| 
      
 70 
     | 
    
         
            +
                ):
         
     | 
| 
      
 71 
     | 
    
         
            +
                    wait_for_ready_state_complete(driver)
         
     | 
| 
       58 
72 
     | 
    
         
             
                    return
         
     | 
| 
       59 
73 
     | 
    
         
             
                if timeout == settings.MINI_TIMEOUT:
         
     | 
| 
       60 
     | 
    
         
            -
                    timeout = settings.MINI_TIMEOUT /  
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
                    timeout = settings.MINI_TIMEOUT / 6.0
         
     | 
| 
       62 
75 
     | 
    
         
             
                NG_WRAPPER = (
         
     | 
| 
       63 
76 
     | 
    
         
             
                    "%(prefix)s"
         
     | 
| 
       64 
77 
     | 
    
         
             
                    "var $elm=document.querySelector("
         
     | 
| 
         @@ -82,20 +95,44 @@ def wait_for_angularjs(driver, timeout=settings.LARGE_TIMEOUT, **kwargs): 
     | 
|
| 
       82 
95 
     | 
    
         
             
                    "handler": handler,
         
     | 
| 
       83 
96 
     | 
    
         
             
                    "suffix": suffix,
         
     | 
| 
       84 
97 
     | 
    
         
             
                }
         
     | 
| 
       85 
     | 
    
         
            -
                 
     | 
| 
       86 
     | 
    
         
            -
                    # This closes any pop-up alerts (otherwise the next part fails)
         
     | 
| 
       87 
     | 
    
         
            -
                    driver.execute_script("")
         
     | 
| 
       88 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       89 
     | 
    
         
            -
                    pass
         
     | 
| 
       90 
     | 
    
         
            -
                try:
         
     | 
| 
      
 98 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       91 
99 
     | 
    
         
             
                    execute_async_script(driver, script, timeout=timeout)
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
            def convert_to_css_selector(selector, by=By.CSS_SELECTOR):
         
     | 
| 
      
 103 
     | 
    
         
            +
                if by == By.CSS_SELECTOR:
         
     | 
| 
      
 104 
     | 
    
         
            +
                    return selector
         
     | 
| 
      
 105 
     | 
    
         
            +
                elif by == By.ID:
         
     | 
| 
      
 106 
     | 
    
         
            +
                    return "#%s" % selector
         
     | 
| 
      
 107 
     | 
    
         
            +
                elif by == By.CLASS_NAME:
         
     | 
| 
      
 108 
     | 
    
         
            +
                    return ".%s" % selector
         
     | 
| 
      
 109 
     | 
    
         
            +
                elif by == By.NAME:
         
     | 
| 
      
 110 
     | 
    
         
            +
                    return '[name="%s"]' % selector
         
     | 
| 
      
 111 
     | 
    
         
            +
                elif by == By.TAG_NAME:
         
     | 
| 
      
 112 
     | 
    
         
            +
                    return selector
         
     | 
| 
      
 113 
     | 
    
         
            +
                elif (
         
     | 
| 
      
 114 
     | 
    
         
            +
                    by == By.XPATH
         
     | 
| 
      
 115 
     | 
    
         
            +
                    or (
         
     | 
| 
      
 116 
     | 
    
         
            +
                        selector.startswith("/")
         
     | 
| 
      
 117 
     | 
    
         
            +
                        or selector.startswith("./")
         
     | 
| 
      
 118 
     | 
    
         
            +
                        or selector.startswith("(")
         
     | 
| 
      
 119 
     | 
    
         
            +
                    )
         
     | 
| 
      
 120 
     | 
    
         
            +
                ):
         
     | 
| 
      
 121 
     | 
    
         
            +
                    return xpath_to_css.convert_xpath_to_css(selector)
         
     | 
| 
      
 122 
     | 
    
         
            +
                elif by == By.LINK_TEXT:
         
     | 
| 
      
 123 
     | 
    
         
            +
                    return 'a:contains("%s")' % selector
         
     | 
| 
      
 124 
     | 
    
         
            +
                elif by == By.PARTIAL_LINK_TEXT:
         
     | 
| 
      
 125 
     | 
    
         
            +
                    return 'a:contains("%s")' % selector
         
     | 
| 
      
 126 
     | 
    
         
            +
                else:
         
     | 
| 
      
 127 
     | 
    
         
            +
                    raise Exception(
         
     | 
| 
      
 128 
     | 
    
         
            +
                        "Exception: Could not convert {%s}(by=%s) to CSS_SELECTOR!"
         
     | 
| 
      
 129 
     | 
    
         
            +
                        % (selector, by)
         
     | 
| 
      
 130 
     | 
    
         
            +
                    )
         
     | 
| 
       94 
131 
     | 
    
         | 
| 
       95 
132 
     | 
    
         | 
| 
       96 
133 
     | 
    
         
             
            def is_html_inspector_activated(driver):
         
     | 
| 
       97 
134 
     | 
    
         
             
                try:
         
     | 
| 
       98 
     | 
    
         
            -
                     
     | 
| 
      
 135 
     | 
    
         
            +
                    execute_script(driver, "HTMLInspector;")  # Fails if not defined
         
     | 
| 
       99 
136 
     | 
    
         
             
                    return True
         
     | 
| 
       100 
137 
     | 
    
         
             
                except Exception:
         
     | 
| 
       101 
138 
     | 
    
         
             
                    return False
         
     | 
| 
         @@ -103,7 +140,7 @@ def is_html_inspector_activated(driver): 
     | 
|
| 
       103 
140 
     | 
    
         | 
| 
       104 
141 
     | 
    
         
             
            def is_jquery_activated(driver):
         
     | 
| 
       105 
142 
     | 
    
         
             
                try:
         
     | 
| 
       106 
     | 
    
         
            -
                     
     | 
| 
      
 143 
     | 
    
         
            +
                    execute_script(driver, "jQuery('html');")  # Fails if jq is not defined
         
     | 
| 
       107 
144 
     | 
    
         
             
                    return True
         
     | 
| 
       108 
145 
     | 
    
         
             
                except Exception:
         
     | 
| 
       109 
146 
     | 
    
         
             
                    return False
         
     | 
| 
         @@ -117,7 +154,7 @@ def wait_for_jquery_active(driver, timeout=None): 
     | 
|
| 
       117 
154 
     | 
    
         
             
                for x in range(timeout):
         
     | 
| 
       118 
155 
     | 
    
         
             
                    # jQuery needs a small amount of time to activate.
         
     | 
| 
       119 
156 
     | 
    
         
             
                    try:
         
     | 
| 
       120 
     | 
    
         
            -
                         
     | 
| 
      
 157 
     | 
    
         
            +
                        execute_script(driver, "jQuery('html');")
         
     | 
| 
       121 
158 
     | 
    
         
             
                        wait_for_ready_state_complete(driver)
         
     | 
| 
       122 
159 
     | 
    
         
             
                        wait_for_angularjs(driver)
         
     | 
| 
       123 
160 
     | 
    
         
             
                        return
         
     | 
| 
         @@ -155,20 +192,18 @@ def raise_unable_to_load_jquery_exception(driver): 
     | 
|
| 
       155 
192 
     | 
    
         
             
            def activate_jquery(driver):
         
     | 
| 
       156 
193 
     | 
    
         
             
                # If "jQuery is not defined" on a website, use this method to activate it.
         
     | 
| 
       157 
194 
     | 
    
         
             
                # This method is needed because jQuery is not always defined on web sites.
         
     | 
| 
       158 
     | 
    
         
            -
                 
     | 
| 
      
 195 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       159 
196 
     | 
    
         
             
                    # Let's first find out if jQuery is already defined.
         
     | 
| 
       160 
     | 
    
         
            -
                     
     | 
| 
      
 197 
     | 
    
         
            +
                    execute_script(driver, "jQuery('html');")
         
     | 
| 
       161 
198 
     | 
    
         
             
                    # Since that command worked, jQuery is defined. Let's return.
         
     | 
| 
       162 
199 
     | 
    
         
             
                    return
         
     | 
| 
       163 
     | 
    
         
            -
                 
     | 
| 
       164 
     | 
    
         
            -
                    # jQuery is not currently defined. Let's proceed by defining it.
         
     | 
| 
       165 
     | 
    
         
            -
                    pass
         
     | 
| 
      
 200 
     | 
    
         
            +
                # jQuery is not defined. It will be loaded in the next part.
         
     | 
| 
       166 
201 
     | 
    
         
             
                jquery_js = constants.JQuery.MIN_JS
         
     | 
| 
       167 
202 
     | 
    
         
             
                add_js_link(driver, jquery_js)
         
     | 
| 
       168 
203 
     | 
    
         
             
                for x in range(36):
         
     | 
| 
       169 
204 
     | 
    
         
             
                    # jQuery needs a small amount of time to activate.
         
     | 
| 
       170 
205 
     | 
    
         
             
                    try:
         
     | 
| 
       171 
     | 
    
         
            -
                         
     | 
| 
      
 206 
     | 
    
         
            +
                        execute_script(driver, "jQuery('html');")
         
     | 
| 
       172 
207 
     | 
    
         
             
                        return
         
     | 
| 
       173 
208 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       174 
209 
     | 
    
         
             
                        if x == 18:
         
     | 
| 
         @@ -212,7 +247,10 @@ def escape_quotes_if_needed(string): 
     | 
|
| 
       212 
247 
     | 
    
         
             
            def is_in_frame(driver):
         
     | 
| 
       213 
248 
     | 
    
         
             
                # Returns True if the driver has switched to a frame.
         
     | 
| 
       214 
249 
     | 
    
         
             
                # Returns False if the driver was on default content.
         
     | 
| 
       215 
     | 
    
         
            -
                 
     | 
| 
      
 250 
     | 
    
         
            +
                if shared_utils.is_cdp_swap_needed(driver):
         
     | 
| 
      
 251 
     | 
    
         
            +
                    return False
         
     | 
| 
      
 252 
     | 
    
         
            +
                in_basic_frame = execute_script(
         
     | 
| 
      
 253 
     | 
    
         
            +
                    driver,
         
     | 
| 
       216 
254 
     | 
    
         
             
                    """
         
     | 
| 
       217 
255 
     | 
    
         
             
                    var frame = window.frameElement;
         
     | 
| 
       218 
256 
     | 
    
         
             
                    if (frame) {
         
     | 
| 
         @@ -223,7 +261,7 @@ def is_in_frame(driver): 
     | 
|
| 
       223 
261 
     | 
    
         
             
                    }
         
     | 
| 
       224 
262 
     | 
    
         
             
                    """
         
     | 
| 
       225 
263 
     | 
    
         
             
                )
         
     | 
| 
       226 
     | 
    
         
            -
                location_href =  
     | 
| 
      
 264 
     | 
    
         
            +
                location_href = execute_script(driver, """return window.location.href;""")
         
     | 
| 
       227 
265 
     | 
    
         
             
                in_external_frame = False
         
     | 
| 
       228 
266 
     | 
    
         
             
                if driver.current_url != location_href:
         
     | 
| 
       229 
267 
     | 
    
         
             
                    in_external_frame = True
         
     | 
| 
         @@ -237,11 +275,11 @@ def safe_execute_script(driver, script): 
     | 
|
| 
       237 
275 
     | 
    
         
             
                it's important that the jQuery library has been loaded first.
         
     | 
| 
       238 
276 
     | 
    
         
             
                This method will load jQuery if it wasn't already loaded."""
         
     | 
| 
       239 
277 
     | 
    
         
             
                try:
         
     | 
| 
       240 
     | 
    
         
            -
                     
     | 
| 
      
 278 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       241 
279 
     | 
    
         
             
                except Exception:
         
     | 
| 
       242 
280 
     | 
    
         
             
                    # The likely reason this fails is because: "jQuery is not defined"
         
     | 
| 
       243 
281 
     | 
    
         
             
                    activate_jquery(driver)  # It's a good thing we can define it here
         
     | 
| 
       244 
     | 
    
         
            -
                     
     | 
| 
      
 282 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       245 
283 
     | 
    
         | 
| 
       246 
284 
     | 
    
         | 
| 
       247 
285 
     | 
    
         
             
            def remove_extra_slashes(selector):
         
     | 
| 
         @@ -297,7 +335,7 @@ def wait_for_css_query_selector( 
     | 
|
| 
       297 
335 
     | 
    
         
             
                stop_ms = start_ms + (timeout * 1000.0)
         
     | 
| 
       298 
336 
     | 
    
         
             
                for x in range(int(timeout * 10)):
         
     | 
| 
       299 
337 
     | 
    
         
             
                    try:
         
     | 
| 
       300 
     | 
    
         
            -
                        element =  
     | 
| 
      
 338 
     | 
    
         
            +
                        element = execute_script(driver, script)
         
     | 
| 
       301 
339 
     | 
    
         
             
                        if element:
         
     | 
| 
       302 
340 
     | 
    
         
             
                            return element
         
     | 
| 
       303 
341 
     | 
    
         
             
                    except Exception:
         
     | 
| 
         @@ -325,6 +363,12 @@ def swap_selector_and_by_if_reversed(selector, by): 
     | 
|
| 
       325 
363 
     | 
    
         
             
                return (selector, by)
         
     | 
| 
       326 
364 
     | 
    
         | 
| 
       327 
365 
     | 
    
         | 
| 
      
 366 
     | 
    
         
            +
            def call_me_later(driver, script, ms):
         
     | 
| 
      
 367 
     | 
    
         
            +
                """Call script after ms passed."""
         
     | 
| 
      
 368 
     | 
    
         
            +
                call = "function() {%s}" % script
         
     | 
| 
      
 369 
     | 
    
         
            +
                execute_script(driver, "window.setTimeout(%s, %s);" % (call, ms))
         
     | 
| 
      
 370 
     | 
    
         
            +
             
     | 
| 
      
 371 
     | 
    
         
            +
             
     | 
| 
       328 
372 
     | 
    
         
             
            def highlight(driver, selector, by="css selector", loops=4):
         
     | 
| 
       329 
373 
     | 
    
         
             
                """For driver.highlight() / driver.page.highlight()"""
         
     | 
| 
       330 
374 
     | 
    
         
             
                swap_selector_and_by_if_reversed(selector, by)
         
     | 
| 
         @@ -348,11 +392,9 @@ def highlight(driver, selector, by="css selector", loops=4): 
     | 
|
| 
       348 
392 
     | 
    
         | 
| 
       349 
393 
     | 
    
         | 
| 
       350 
394 
     | 
    
         
             
            def highlight_with_js(driver, selector, loops=4, o_bs=""):
         
     | 
| 
       351 
     | 
    
         
            -
                 
     | 
| 
      
 395 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       352 
396 
     | 
    
         
             
                    # This closes any pop-up alerts
         
     | 
| 
       353 
     | 
    
         
            -
                     
     | 
| 
       354 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       355 
     | 
    
         
            -
                    pass
         
     | 
| 
      
 397 
     | 
    
         
            +
                    execute_script(driver, "")
         
     | 
| 
       356 
398 
     | 
    
         
             
                if selector == "html":
         
     | 
| 
       357 
399 
     | 
    
         
             
                    selector = "body"
         
     | 
| 
       358 
400 
     | 
    
         
             
                selector_no_spaces = selector.replace(" ", "")
         
     | 
| 
         @@ -372,7 +414,7 @@ def highlight_with_js(driver, selector, loops=4, o_bs=""): 
     | 
|
| 
       372 
414 
     | 
    
         
             
                    % selector
         
     | 
| 
       373 
415 
     | 
    
         
             
                )
         
     | 
| 
       374 
416 
     | 
    
         
             
                try:
         
     | 
| 
       375 
     | 
    
         
            -
                     
     | 
| 
      
 417 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       376 
418 
     | 
    
         
             
                except Exception:
         
     | 
| 
       377 
419 
     | 
    
         
             
                    return
         
     | 
| 
       378 
420 
     | 
    
         
             
                for n in range(loops):
         
     | 
| 
         @@ -382,7 +424,7 @@ def highlight_with_js(driver, selector, loops=4, o_bs=""): 
     | 
|
| 
       382 
424 
     | 
    
         
             
                        % selector
         
     | 
| 
       383 
425 
     | 
    
         
             
                    )
         
     | 
| 
       384 
426 
     | 
    
         
             
                    try:
         
     | 
| 
       385 
     | 
    
         
            -
                         
     | 
| 
      
 427 
     | 
    
         
            +
                        execute_script(driver, script)
         
     | 
| 
       386 
428 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       387 
429 
     | 
    
         
             
                        return
         
     | 
| 
       388 
430 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -392,7 +434,7 @@ def highlight_with_js(driver, selector, loops=4, o_bs=""): 
     | 
|
| 
       392 
434 
     | 
    
         
             
                        % selector
         
     | 
| 
       393 
435 
     | 
    
         
             
                    )
         
     | 
| 
       394 
436 
     | 
    
         
             
                    try:
         
     | 
| 
       395 
     | 
    
         
            -
                         
     | 
| 
      
 437 
     | 
    
         
            +
                        execute_script(driver, script)
         
     | 
| 
       396 
438 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       397 
439 
     | 
    
         
             
                        return
         
     | 
| 
       398 
440 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -402,7 +444,7 @@ def highlight_with_js(driver, selector, loops=4, o_bs=""): 
     | 
|
| 
       402 
444 
     | 
    
         
             
                        % selector
         
     | 
| 
       403 
445 
     | 
    
         
             
                    )
         
     | 
| 
       404 
446 
     | 
    
         
             
                    try:
         
     | 
| 
       405 
     | 
    
         
            -
                         
     | 
| 
      
 447 
     | 
    
         
            +
                        execute_script(driver, script)
         
     | 
| 
       406 
448 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       407 
449 
     | 
    
         
             
                        return
         
     | 
| 
       408 
450 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -412,7 +454,7 @@ def highlight_with_js(driver, selector, loops=4, o_bs=""): 
     | 
|
| 
       412 
454 
     | 
    
         
             
                        % selector
         
     | 
| 
       413 
455 
     | 
    
         
             
                    )
         
     | 
| 
       414 
456 
     | 
    
         
             
                    try:
         
     | 
| 
       415 
     | 
    
         
            -
                         
     | 
| 
      
 457 
     | 
    
         
            +
                        execute_script(driver, script)
         
     | 
| 
       416 
458 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       417 
459 
     | 
    
         
             
                        return
         
     | 
| 
       418 
460 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -422,7 +464,7 @@ def highlight_with_js(driver, selector, loops=4, o_bs=""): 
     | 
|
| 
       422 
464 
     | 
    
         
             
                        % selector
         
     | 
| 
       423 
465 
     | 
    
         
             
                    )
         
     | 
| 
       424 
466 
     | 
    
         
             
                    try:
         
     | 
| 
       425 
     | 
    
         
            -
                         
     | 
| 
      
 467 
     | 
    
         
            +
                        execute_script(driver, script)
         
     | 
| 
       426 
468 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       427 
469 
     | 
    
         
             
                        return
         
     | 
| 
       428 
470 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -432,7 +474,7 @@ def highlight_with_js(driver, selector, loops=4, o_bs=""): 
     | 
|
| 
       432 
474 
     | 
    
         
             
                        % selector
         
     | 
| 
       433 
475 
     | 
    
         
             
                    )
         
     | 
| 
       434 
476 
     | 
    
         
             
                    try:
         
     | 
| 
       435 
     | 
    
         
            -
                         
     | 
| 
      
 477 
     | 
    
         
            +
                        execute_script(driver, script)
         
     | 
| 
       436 
478 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       437 
479 
     | 
    
         
             
                        return
         
     | 
| 
       438 
480 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -442,23 +484,21 @@ def highlight_with_js(driver, selector, loops=4, o_bs=""): 
     | 
|
| 
       442 
484 
     | 
    
         
             
                    o_bs,
         
     | 
| 
       443 
485 
     | 
    
         
             
                )
         
     | 
| 
       444 
486 
     | 
    
         
             
                try:
         
     | 
| 
       445 
     | 
    
         
            -
                     
     | 
| 
      
 487 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       446 
488 
     | 
    
         
             
                except Exception:
         
     | 
| 
       447 
489 
     | 
    
         
             
                    return
         
     | 
| 
       448 
490 
     | 
    
         | 
| 
       449 
491 
     | 
    
         | 
| 
       450 
492 
     | 
    
         
             
            def highlight_element_with_js(driver, element, loops=4, o_bs=""):
         
     | 
| 
       451 
     | 
    
         
            -
                 
     | 
| 
      
 493 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       452 
494 
     | 
    
         
             
                    # This closes any pop-up alerts
         
     | 
| 
       453 
     | 
    
         
            -
                     
     | 
| 
       454 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       455 
     | 
    
         
            -
                    pass
         
     | 
| 
      
 495 
     | 
    
         
            +
                    execute_script(driver, "")
         
     | 
| 
       456 
496 
     | 
    
         
             
                script = (
         
     | 
| 
       457 
497 
     | 
    
         
             
                    """arguments[0].style.boxShadow =
         
     | 
| 
       458 
498 
     | 
    
         
             
                    '0px 0px 6px 6px rgba(128, 128, 128, 0.5)';"""
         
     | 
| 
       459 
499 
     | 
    
         
             
                )
         
     | 
| 
       460 
500 
     | 
    
         
             
                try:
         
     | 
| 
       461 
     | 
    
         
            -
                     
     | 
| 
      
 501 
     | 
    
         
            +
                    execute_script(driver, script, element)
         
     | 
| 
       462 
502 
     | 
    
         
             
                except Exception:
         
     | 
| 
       463 
503 
     | 
    
         
             
                    return
         
     | 
| 
       464 
504 
     | 
    
         
             
                for n in range(loops):
         
     | 
| 
         @@ -467,7 +507,7 @@ def highlight_element_with_js(driver, element, loops=4, o_bs=""): 
     | 
|
| 
       467 
507 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(255, 0, 0, 1)';"""
         
     | 
| 
       468 
508 
     | 
    
         
             
                    )
         
     | 
| 
       469 
509 
     | 
    
         
             
                    try:
         
     | 
| 
       470 
     | 
    
         
            -
                         
     | 
| 
      
 510 
     | 
    
         
            +
                        execute_script(driver, script, element)
         
     | 
| 
       471 
511 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       472 
512 
     | 
    
         
             
                        return
         
     | 
| 
       473 
513 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -476,7 +516,7 @@ def highlight_element_with_js(driver, element, loops=4, o_bs=""): 
     | 
|
| 
       476 
516 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(128, 0, 128, 1)';"""
         
     | 
| 
       477 
517 
     | 
    
         
             
                    )
         
     | 
| 
       478 
518 
     | 
    
         
             
                    try:
         
     | 
| 
       479 
     | 
    
         
            -
                         
     | 
| 
      
 519 
     | 
    
         
            +
                        execute_script(driver, script, element)
         
     | 
| 
       480 
520 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       481 
521 
     | 
    
         
             
                        return
         
     | 
| 
       482 
522 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -485,7 +525,7 @@ def highlight_element_with_js(driver, element, loops=4, o_bs=""): 
     | 
|
| 
       485 
525 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(0, 0, 255, 1)';"""
         
     | 
| 
       486 
526 
     | 
    
         
             
                    )
         
     | 
| 
       487 
527 
     | 
    
         
             
                    try:
         
     | 
| 
       488 
     | 
    
         
            -
                         
     | 
| 
      
 528 
     | 
    
         
            +
                        execute_script(driver, script, element)
         
     | 
| 
       489 
529 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       490 
530 
     | 
    
         
             
                        return
         
     | 
| 
       491 
531 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -494,7 +534,7 @@ def highlight_element_with_js(driver, element, loops=4, o_bs=""): 
     | 
|
| 
       494 
534 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(0, 255, 0, 1)';"""
         
     | 
| 
       495 
535 
     | 
    
         
             
                    )
         
     | 
| 
       496 
536 
     | 
    
         
             
                    try:
         
     | 
| 
       497 
     | 
    
         
            -
                         
     | 
| 
      
 537 
     | 
    
         
            +
                        execute_script(driver, script, element)
         
     | 
| 
       498 
538 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       499 
539 
     | 
    
         
             
                        return
         
     | 
| 
       500 
540 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -503,7 +543,7 @@ def highlight_element_with_js(driver, element, loops=4, o_bs=""): 
     | 
|
| 
       503 
543 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(128, 128, 0, 1)';"""
         
     | 
| 
       504 
544 
     | 
    
         
             
                    )
         
     | 
| 
       505 
545 
     | 
    
         
             
                    try:
         
     | 
| 
       506 
     | 
    
         
            -
                         
     | 
| 
      
 546 
     | 
    
         
            +
                        execute_script(driver, script, element)
         
     | 
| 
       507 
547 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       508 
548 
     | 
    
         
             
                        return
         
     | 
| 
       509 
549 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
         @@ -512,23 +552,21 @@ def highlight_element_with_js(driver, element, loops=4, o_bs=""): 
     | 
|
| 
       512 
552 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(128, 0, 128, 1)';"""
         
     | 
| 
       513 
553 
     | 
    
         
             
                    )
         
     | 
| 
       514 
554 
     | 
    
         
             
                    try:
         
     | 
| 
       515 
     | 
    
         
            -
                         
     | 
| 
      
 555 
     | 
    
         
            +
                        execute_script(driver, script, element)
         
     | 
| 
       516 
556 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       517 
557 
     | 
    
         
             
                        return
         
     | 
| 
       518 
558 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
       519 
559 
     | 
    
         
             
                script = """arguments[0].style.boxShadow = '%s';""" % (o_bs)
         
     | 
| 
       520 
560 
     | 
    
         
             
                try:
         
     | 
| 
       521 
     | 
    
         
            -
                     
     | 
| 
      
 561 
     | 
    
         
            +
                    execute_script(driver, script, element)
         
     | 
| 
       522 
562 
     | 
    
         
             
                except Exception:
         
     | 
| 
       523 
563 
     | 
    
         
             
                    return
         
     | 
| 
       524 
564 
     | 
    
         | 
| 
       525 
565 
     | 
    
         | 
| 
       526 
566 
     | 
    
         
             
            def highlight_with_jquery(driver, selector, loops=4, o_bs=""):
         
     | 
| 
       527 
     | 
    
         
            -
                 
     | 
| 
      
 567 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       528 
568 
     | 
    
         
             
                    # This closes any pop-up alerts
         
     | 
| 
       529 
     | 
    
         
            -
                     
     | 
| 
       530 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       531 
     | 
    
         
            -
                    pass
         
     | 
| 
      
 569 
     | 
    
         
            +
                    execute_script(driver, "")
         
     | 
| 
       532 
570 
     | 
    
         
             
                if selector == "html":
         
     | 
| 
       533 
571 
     | 
    
         
             
                    selector = "body"
         
     | 
| 
       534 
572 
     | 
    
         
             
                selector_no_spaces = selector.replace(" ", "")
         
     | 
| 
         @@ -554,45 +592,45 @@ def highlight_with_jquery(driver, selector, loops=4, o_bs=""): 
     | 
|
| 
       554 
592 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(255, 0, 0, 1)');"""
         
     | 
| 
       555 
593 
     | 
    
         
             
                        % selector
         
     | 
| 
       556 
594 
     | 
    
         
             
                    )
         
     | 
| 
       557 
     | 
    
         
            -
                     
     | 
| 
      
 595 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       558 
596 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
       559 
597 
     | 
    
         
             
                    script = (
         
     | 
| 
       560 
598 
     | 
    
         
             
                        """jQuery('%s').css('box-shadow',
         
     | 
| 
       561 
599 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(128, 0, 128, 1)');"""
         
     | 
| 
       562 
600 
     | 
    
         
             
                        % selector
         
     | 
| 
       563 
601 
     | 
    
         
             
                    )
         
     | 
| 
       564 
     | 
    
         
            -
                     
     | 
| 
      
 602 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       565 
603 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
       566 
604 
     | 
    
         
             
                    script = (
         
     | 
| 
       567 
605 
     | 
    
         
             
                        """jQuery('%s').css('box-shadow',
         
     | 
| 
       568 
606 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(0, 0, 255, 1)');"""
         
     | 
| 
       569 
607 
     | 
    
         
             
                        % selector
         
     | 
| 
       570 
608 
     | 
    
         
             
                    )
         
     | 
| 
       571 
     | 
    
         
            -
                     
     | 
| 
      
 609 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       572 
610 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
       573 
611 
     | 
    
         
             
                    script = (
         
     | 
| 
       574 
612 
     | 
    
         
             
                        """jQuery('%s').css('box-shadow',
         
     | 
| 
       575 
613 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(0, 255, 0, 1)');"""
         
     | 
| 
       576 
614 
     | 
    
         
             
                        % selector
         
     | 
| 
       577 
615 
     | 
    
         
             
                    )
         
     | 
| 
       578 
     | 
    
         
            -
                     
     | 
| 
      
 616 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       579 
617 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
       580 
618 
     | 
    
         
             
                    script = (
         
     | 
| 
       581 
619 
     | 
    
         
             
                        """jQuery('%s').css('box-shadow',
         
     | 
| 
       582 
620 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(128, 128, 0, 1)');"""
         
     | 
| 
       583 
621 
     | 
    
         
             
                        % selector
         
     | 
| 
       584 
622 
     | 
    
         
             
                    )
         
     | 
| 
       585 
     | 
    
         
            -
                     
     | 
| 
      
 623 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       586 
624 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
       587 
625 
     | 
    
         
             
                    script = (
         
     | 
| 
       588 
626 
     | 
    
         
             
                        """jQuery('%s').css('box-shadow',
         
     | 
| 
       589 
627 
     | 
    
         
             
                        '0px 0px 6px 6px rgba(128, 0, 128, 1)');"""
         
     | 
| 
       590 
628 
     | 
    
         
             
                        % selector
         
     | 
| 
       591 
629 
     | 
    
         
             
                    )
         
     | 
| 
       592 
     | 
    
         
            -
                     
     | 
| 
      
 630 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       593 
631 
     | 
    
         
             
                    time.sleep(0.0181)
         
     | 
| 
       594 
632 
     | 
    
         
             
                script = """jQuery('%s').css('box-shadow', '%s');""" % (selector, o_bs)
         
     | 
| 
       595 
     | 
    
         
            -
                 
     | 
| 
      
 633 
     | 
    
         
            +
                execute_script(driver, script)
         
     | 
| 
       596 
634 
     | 
    
         | 
| 
       597 
635 
     | 
    
         | 
| 
       598 
636 
     | 
    
         
             
            def add_css_link(driver, css_link):
         
     | 
| 
         @@ -607,7 +645,7 @@ def add_css_link(driver, css_link): 
     | 
|
| 
       607 
645 
     | 
    
         
             
                   }
         
     | 
| 
       608 
646 
     | 
    
         
             
                   injectCSS("%s");"""
         
     | 
| 
       609 
647 
     | 
    
         
             
                css_link = escape_quotes_if_needed(css_link)
         
     | 
| 
       610 
     | 
    
         
            -
                 
     | 
| 
      
 648 
     | 
    
         
            +
                execute_script(driver, script_to_add_css % css_link)
         
     | 
| 
       611 
649 
     | 
    
         | 
| 
       612 
650 
     | 
    
         | 
| 
       613 
651 
     | 
    
         
             
            def add_js_link(driver, js_link):
         
     | 
| 
         @@ -623,7 +661,7 @@ def add_js_link(driver, js_link): 
     | 
|
| 
       623 
661 
     | 
    
         
             
                   }
         
     | 
| 
       624 
662 
     | 
    
         
             
                   injectJS("%s");"""
         
     | 
| 
       625 
663 
     | 
    
         
             
                js_link = escape_quotes_if_needed(js_link)
         
     | 
| 
       626 
     | 
    
         
            -
                 
     | 
| 
      
 664 
     | 
    
         
            +
                execute_script(driver, script_to_add_js % js_link)
         
     | 
| 
       627 
665 
     | 
    
         | 
| 
       628 
666 
     | 
    
         | 
| 
       629 
667 
     | 
    
         
             
            def add_css_style(driver, css_style):
         
     | 
| 
         @@ -637,7 +675,7 @@ def add_css_style(driver, css_style): 
     | 
|
| 
       637 
675 
     | 
    
         
             
                   injectStyle("%s");"""
         
     | 
| 
       638 
676 
     | 
    
         
             
                css_style = css_style.replace("\n", "")
         
     | 
| 
       639 
677 
     | 
    
         
             
                css_style = escape_quotes_if_needed(css_style)
         
     | 
| 
       640 
     | 
    
         
            -
                 
     | 
| 
      
 678 
     | 
    
         
            +
                execute_script(driver, add_css_style_script % css_style)
         
     | 
| 
       641 
679 
     | 
    
         | 
| 
       642 
680 
     | 
    
         | 
| 
       643 
681 
     | 
    
         
             
            def add_js_code_from_link(driver, js_link):
         
     | 
| 
         @@ -654,7 +692,7 @@ def add_js_code_from_link(driver, js_link): 
     | 
|
| 
       654 
692 
     | 
    
         
             
                )
         
     | 
| 
       655 
693 
     | 
    
         
             
                js_code = js_code.replace("\n", " ")
         
     | 
| 
       656 
694 
     | 
    
         
             
                js_code = escape_quotes_if_needed(js_code)
         
     | 
| 
       657 
     | 
    
         
            -
                 
     | 
| 
      
 695 
     | 
    
         
            +
                execute_script(driver, add_js_code_script % js_code)
         
     | 
| 
       658 
696 
     | 
    
         | 
| 
       659 
697 
     | 
    
         | 
| 
       660 
698 
     | 
    
         
             
            def add_js_code(driver, js_code):
         
     | 
| 
         @@ -668,7 +706,7 @@ def add_js_code(driver, js_code): 
     | 
|
| 
       668 
706 
     | 
    
         
             
                )
         
     | 
| 
       669 
707 
     | 
    
         
             
                js_code = js_code.replace("\n", " ")
         
     | 
| 
       670 
708 
     | 
    
         
             
                js_code = escape_quotes_if_needed(js_code)
         
     | 
| 
       671 
     | 
    
         
            -
                 
     | 
| 
      
 709 
     | 
    
         
            +
                execute_script(driver, add_js_code_script % js_code)
         
     | 
| 
       672 
710 
     | 
    
         | 
| 
       673 
711 
     | 
    
         | 
| 
       674 
712 
     | 
    
         
             
            def add_meta_tag(driver, http_equiv=None, content=None):
         
     | 
| 
         @@ -689,12 +727,12 @@ def add_meta_tag(driver, http_equiv=None, content=None): 
     | 
|
| 
       689 
727 
     | 
    
         
             
                    http_equiv,
         
     | 
| 
       690 
728 
     | 
    
         
             
                    content,
         
     | 
| 
       691 
729 
     | 
    
         
             
                )
         
     | 
| 
       692 
     | 
    
         
            -
                 
     | 
| 
      
 730 
     | 
    
         
            +
                execute_script(driver, script_to_add_meta)
         
     | 
| 
       693 
731 
     | 
    
         | 
| 
       694 
732 
     | 
    
         | 
| 
       695 
733 
     | 
    
         
             
            def is_jquery_confirm_activated(driver):
         
     | 
| 
       696 
734 
     | 
    
         
             
                try:
         
     | 
| 
       697 
     | 
    
         
            -
                     
     | 
| 
      
 735 
     | 
    
         
            +
                    execute_script(driver, "jconfirm;")  # Fails if jconfirm is not defined
         
     | 
| 
       698 
736 
     | 
    
         
             
                    return True
         
     | 
| 
       699 
737 
     | 
    
         
             
                except Exception:
         
     | 
| 
       700 
738 
     | 
    
         
             
                    return False
         
     | 
| 
         @@ -717,7 +755,7 @@ def activate_jquery_confirm(driver): 
     | 
|
| 
       717 
755 
     | 
    
         
             
                        add_css_link(driver, jq_confirm_css)
         
     | 
| 
       718 
756 
     | 
    
         
             
                        add_js_link(driver, jq_confirm_js)
         
     | 
| 
       719 
757 
     | 
    
         
             
                    try:
         
     | 
| 
       720 
     | 
    
         
            -
                         
     | 
| 
      
 758 
     | 
    
         
            +
                        execute_script(driver, "jconfirm;")
         
     | 
| 
       721 
759 
     | 
    
         
             
                        wait_for_ready_state_complete(driver)
         
     | 
| 
       722 
760 
     | 
    
         
             
                        wait_for_angularjs(driver)
         
     | 
| 
       723 
761 
     | 
    
         
             
                        return
         
     | 
| 
         @@ -743,7 +781,7 @@ def activate_html_inspector(driver): 
     | 
|
| 
       743 
781 
     | 
    
         
             
                for x in range(25):
         
     | 
| 
       744 
782 
     | 
    
         
             
                    # HTML-Inspector needs a small amount of time to load & activate.
         
     | 
| 
       745 
783 
     | 
    
         
             
                    try:
         
     | 
| 
       746 
     | 
    
         
            -
                         
     | 
| 
      
 784 
     | 
    
         
            +
                        execute_script(driver, "HTMLInspector;")
         
     | 
| 
       747 
785 
     | 
    
         
             
                        wait_for_ready_state_complete(driver)
         
     | 
| 
       748 
786 
     | 
    
         
             
                        wait_for_angularjs(driver)
         
     | 
| 
       749 
787 
     | 
    
         
             
                        return
         
     | 
| 
         @@ -793,7 +831,8 @@ def activate_messenger(driver): 
     | 
|
| 
       793 
831 
     | 
    
         
             
                for x in range(10):
         
     | 
| 
       794 
832 
     | 
    
         
             
                    # Messenger needs a small amount of time to load & activate.
         
     | 
| 
       795 
833 
     | 
    
         
             
                    try:
         
     | 
| 
       796 
     | 
    
         
            -
                        result =  
     | 
| 
      
 834 
     | 
    
         
            +
                        result = execute_script(
         
     | 
| 
      
 835 
     | 
    
         
            +
                            driver,
         
     | 
| 
       797 
836 
     | 
    
         
             
                            """ if (typeof Messenger === 'undefined') { return "U"; } """
         
     | 
| 
       798 
837 
     | 
    
         
             
                        )
         
     | 
| 
       799 
838 
     | 
    
         
             
                        if result == "U":
         
     | 
| 
         @@ -804,7 +843,7 @@ def activate_messenger(driver): 
     | 
|
| 
       804 
843 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       805 
844 
     | 
    
         
             
                        time.sleep(0.02)
         
     | 
| 
       806 
845 
     | 
    
         
             
                try:
         
     | 
| 
       807 
     | 
    
         
            -
                     
     | 
| 
      
 846 
     | 
    
         
            +
                    execute_script(driver, msg_style)
         
     | 
| 
       808 
847 
     | 
    
         
             
                    add_js_link(driver, msgr_theme_flat_js)
         
     | 
| 
       809 
848 
     | 
    
         
             
                    add_js_link(driver, msgr_theme_future_js)
         
     | 
| 
       810 
849 
     | 
    
         
             
                    wait_for_ready_state_complete(driver)
         
     | 
| 
         @@ -861,16 +900,14 @@ def set_messenger_theme( 
     | 
|
| 
       861 
900 
     | 
    
         
             
                    % (max_messages, messenger_location, theme)
         
     | 
| 
       862 
901 
     | 
    
         
             
                )
         
     | 
| 
       863 
902 
     | 
    
         
             
                try:
         
     | 
| 
       864 
     | 
    
         
            -
                     
     | 
| 
      
 903 
     | 
    
         
            +
                    execute_script(driver, msg_style)
         
     | 
| 
       865 
904 
     | 
    
         
             
                except Exception:
         
     | 
| 
       866 
905 
     | 
    
         
             
                    time.sleep(0.03)
         
     | 
| 
       867 
906 
     | 
    
         
             
                    activate_messenger(driver)
         
     | 
| 
       868 
907 
     | 
    
         
             
                    time.sleep(0.15)
         
     | 
| 
       869 
     | 
    
         
            -
                     
     | 
| 
       870 
     | 
    
         
            -
                         
     | 
| 
      
 908 
     | 
    
         
            +
                    with suppress(Exception):
         
     | 
| 
      
 909 
     | 
    
         
            +
                        execute_script(driver, msg_style)
         
     | 
| 
       871 
910 
     | 
    
         
             
                        time.sleep(0.02)
         
     | 
| 
       872 
     | 
    
         
            -
                    except Exception:
         
     | 
| 
       873 
     | 
    
         
            -
                        pass
         
     | 
| 
       874 
911 
     | 
    
         
             
                time.sleep(0.05)
         
     | 
| 
       875 
912 
     | 
    
         | 
| 
       876 
913 
     | 
    
         | 
| 
         @@ -888,26 +925,26 @@ def post_message(driver, message, msg_dur=None, style="info"): 
     | 
|
| 
       888 
925 
     | 
    
         
             
                    % (message, style, msg_dur)
         
     | 
| 
       889 
926 
     | 
    
         
             
                )
         
     | 
| 
       890 
927 
     | 
    
         
             
                try:
         
     | 
| 
       891 
     | 
    
         
            -
                     
     | 
| 
      
 928 
     | 
    
         
            +
                    execute_script(driver, messenger_script)
         
     | 
| 
       892 
929 
     | 
    
         
             
                except Exception:
         
     | 
| 
       893 
930 
     | 
    
         
             
                    activate_messenger(driver)
         
     | 
| 
       894 
931 
     | 
    
         
             
                    set_messenger_theme(driver)
         
     | 
| 
       895 
932 
     | 
    
         
             
                    try:
         
     | 
| 
       896 
     | 
    
         
            -
                         
     | 
| 
      
 933 
     | 
    
         
            +
                        execute_script(driver, messenger_script)
         
     | 
| 
       897 
934 
     | 
    
         
             
                    except Exception:
         
     | 
| 
       898 
935 
     | 
    
         
             
                        time.sleep(0.17)
         
     | 
| 
       899 
936 
     | 
    
         
             
                        activate_messenger(driver)
         
     | 
| 
       900 
937 
     | 
    
         
             
                        time.sleep(0.17)
         
     | 
| 
       901 
938 
     | 
    
         
             
                        set_messenger_theme(driver)
         
     | 
| 
       902 
939 
     | 
    
         
             
                        time.sleep(0.27)
         
     | 
| 
       903 
     | 
    
         
            -
                         
     | 
| 
      
 940 
     | 
    
         
            +
                        execute_script(driver, messenger_script)
         
     | 
| 
       904 
941 
     | 
    
         | 
| 
       905 
942 
     | 
    
         | 
| 
       906 
943 
     | 
    
         
             
            def post_messenger_success_message(driver, message, msg_dur=None):
         
     | 
| 
       907 
944 
     | 
    
         
             
                if not msg_dur:
         
     | 
| 
       908 
945 
     | 
    
         
             
                    msg_dur = settings.DEFAULT_MESSAGE_DURATION
         
     | 
| 
       909 
946 
     | 
    
         
             
                msg_dur = float(msg_dur)
         
     | 
| 
       910 
     | 
    
         
            -
                 
     | 
| 
      
 947 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       911 
948 
     | 
    
         
             
                    theme = "future"
         
     | 
| 
       912 
949 
     | 
    
         
             
                    location = "bottom_right"
         
     | 
| 
       913 
950 
     | 
    
         
             
                    if hasattr(sb_config, "mobile_emulator") and sb_config.mobile_emulator:
         
     | 
| 
         @@ -915,28 +952,22 @@ def post_messenger_success_message(driver, message, msg_dur=None): 
     | 
|
| 
       915 
952 
     | 
    
         
             
                    set_messenger_theme(driver, theme=theme, location=location)
         
     | 
| 
       916 
953 
     | 
    
         
             
                    post_message(driver, message, msg_dur, style="success")
         
     | 
| 
       917 
954 
     | 
    
         
             
                    time.sleep(msg_dur + 0.07)
         
     | 
| 
       918 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       919 
     | 
    
         
            -
                    pass
         
     | 
| 
       920 
955 
     | 
    
         | 
| 
       921 
956 
     | 
    
         | 
| 
       922 
957 
     | 
    
         
             
            def post_messenger_error_message(driver, message, msg_dur=None):
         
     | 
| 
       923 
958 
     | 
    
         
             
                if not msg_dur:
         
     | 
| 
       924 
959 
     | 
    
         
             
                    msg_dur = settings.DEFAULT_MESSAGE_DURATION
         
     | 
| 
       925 
960 
     | 
    
         
             
                msg_dur = float(msg_dur)
         
     | 
| 
       926 
     | 
    
         
            -
                 
     | 
| 
      
 961 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       927 
962 
     | 
    
         
             
                    set_messenger_theme(driver, theme="block", location="top_center")
         
     | 
| 
       928 
963 
     | 
    
         
             
                    post_message(driver, message, msg_dur, style="error")
         
     | 
| 
       929 
964 
     | 
    
         
             
                    time.sleep(msg_dur + 0.07)
         
     | 
| 
       930 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       931 
     | 
    
         
            -
                    pass
         
     | 
| 
       932 
965 
     | 
    
         | 
| 
       933 
966 
     | 
    
         | 
| 
       934 
967 
     | 
    
         
             
            def highlight_with_js_2(driver, message, selector, o_bs, msg_dur):
         
     | 
| 
       935 
     | 
    
         
            -
                 
     | 
| 
      
 968 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       936 
969 
     | 
    
         
             
                    # This closes any pop-up alerts
         
     | 
| 
       937 
     | 
    
         
            -
                     
     | 
| 
       938 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       939 
     | 
    
         
            -
                    pass
         
     | 
| 
      
 970 
     | 
    
         
            +
                    execute_script(driver, "")
         
     | 
| 
       940 
971 
     | 
    
         
             
                if selector == "html":
         
     | 
| 
       941 
972 
     | 
    
         
             
                    selector = "body"
         
     | 
| 
       942 
973 
     | 
    
         
             
                selector_no_spaces = selector.replace(" ", "")
         
     | 
| 
         @@ -949,11 +980,9 @@ def highlight_with_js_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       949 
980 
     | 
    
         
             
                    else:
         
     | 
| 
       950 
981 
     | 
    
         
             
                        early_exit = True  # Changing the box-shadow changes the selector
         
     | 
| 
       951 
982 
     | 
    
         
             
                    if early_exit:
         
     | 
| 
       952 
     | 
    
         
            -
                         
     | 
| 
      
 983 
     | 
    
         
            +
                        with suppress(Exception):
         
     | 
| 
       953 
984 
     | 
    
         
             
                            activate_jquery(driver)
         
     | 
| 
       954 
985 
     | 
    
         
             
                            post_messenger_success_message(driver, message, msg_dur)
         
     | 
| 
       955 
     | 
    
         
            -
                        except Exception:
         
     | 
| 
       956 
     | 
    
         
            -
                            pass
         
     | 
| 
       957 
986 
     | 
    
         
             
                        return
         
     | 
| 
       958 
987 
     | 
    
         
             
                script = (
         
     | 
| 
       959 
988 
     | 
    
         
             
                    """document.querySelector('%s').style.boxShadow =
         
     | 
| 
         @@ -961,7 +990,7 @@ def highlight_with_js_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       961 
990 
     | 
    
         
             
                    % selector
         
     | 
| 
       962 
991 
     | 
    
         
             
                )
         
     | 
| 
       963 
992 
     | 
    
         
             
                try:
         
     | 
| 
       964 
     | 
    
         
            -
                     
     | 
| 
      
 993 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       965 
994 
     | 
    
         
             
                except Exception:
         
     | 
| 
       966 
995 
     | 
    
         
             
                    return
         
     | 
| 
       967 
996 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -971,7 +1000,7 @@ def highlight_with_js_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       971 
1000 
     | 
    
         
             
                    % selector
         
     | 
| 
       972 
1001 
     | 
    
         
             
                )
         
     | 
| 
       973 
1002 
     | 
    
         
             
                try:
         
     | 
| 
       974 
     | 
    
         
            -
                     
     | 
| 
      
 1003 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       975 
1004 
     | 
    
         
             
                except Exception:
         
     | 
| 
       976 
1005 
     | 
    
         
             
                    return
         
     | 
| 
       977 
1006 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -981,7 +1010,7 @@ def highlight_with_js_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       981 
1010 
     | 
    
         
             
                    % selector
         
     | 
| 
       982 
1011 
     | 
    
         
             
                )
         
     | 
| 
       983 
1012 
     | 
    
         
             
                try:
         
     | 
| 
       984 
     | 
    
         
            -
                     
     | 
| 
      
 1013 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       985 
1014 
     | 
    
         
             
                except Exception:
         
     | 
| 
       986 
1015 
     | 
    
         
             
                    return
         
     | 
| 
       987 
1016 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -991,7 +1020,7 @@ def highlight_with_js_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       991 
1020 
     | 
    
         
             
                    % selector
         
     | 
| 
       992 
1021 
     | 
    
         
             
                )
         
     | 
| 
       993 
1022 
     | 
    
         
             
                try:
         
     | 
| 
       994 
     | 
    
         
            -
                     
     | 
| 
      
 1023 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       995 
1024 
     | 
    
         
             
                except Exception:
         
     | 
| 
       996 
1025 
     | 
    
         
             
                    return
         
     | 
| 
       997 
1026 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -1001,37 +1030,33 @@ def highlight_with_js_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       1001 
1030 
     | 
    
         
             
                    % selector
         
     | 
| 
       1002 
1031 
     | 
    
         
             
                )
         
     | 
| 
       1003 
1032 
     | 
    
         
             
                try:
         
     | 
| 
       1004 
     | 
    
         
            -
                     
     | 
| 
      
 1033 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       1005 
1034 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1006 
1035 
     | 
    
         
             
                    return
         
     | 
| 
       1007 
1036 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
       1008 
     | 
    
         
            -
                 
     | 
| 
      
 1037 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       1009 
1038 
     | 
    
         
             
                    activate_jquery(driver)
         
     | 
| 
       1010 
1039 
     | 
    
         
             
                    post_messenger_success_message(driver, message, msg_dur)
         
     | 
| 
       1011 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       1012 
     | 
    
         
            -
                    pass
         
     | 
| 
       1013 
1040 
     | 
    
         
             
                script = """document.querySelector('%s').style.boxShadow = '%s';""" % (
         
     | 
| 
       1014 
1041 
     | 
    
         
             
                    selector,
         
     | 
| 
       1015 
1042 
     | 
    
         
             
                    o_bs,
         
     | 
| 
       1016 
1043 
     | 
    
         
             
                )
         
     | 
| 
       1017 
1044 
     | 
    
         
             
                try:
         
     | 
| 
       1018 
     | 
    
         
            -
                     
     | 
| 
      
 1045 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       1019 
1046 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1020 
1047 
     | 
    
         
             
                    return
         
     | 
| 
       1021 
1048 
     | 
    
         | 
| 
       1022 
1049 
     | 
    
         | 
| 
       1023 
1050 
     | 
    
         
             
            def highlight_element_with_js_2(driver, message, element, o_bs, msg_dur):
         
     | 
| 
       1024 
     | 
    
         
            -
                 
     | 
| 
      
 1051 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       1025 
1052 
     | 
    
         
             
                    # This closes any pop-up alerts
         
     | 
| 
       1026 
     | 
    
         
            -
                     
     | 
| 
       1027 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       1028 
     | 
    
         
            -
                    pass
         
     | 
| 
      
 1053 
     | 
    
         
            +
                    execute_script(driver, "")
         
     | 
| 
       1029 
1054 
     | 
    
         
             
                script = (
         
     | 
| 
       1030 
1055 
     | 
    
         
             
                    """arguments[0].style.boxShadow =
         
     | 
| 
       1031 
1056 
     | 
    
         
             
                    '0px 0px 6px 6px rgba(128, 128, 128, 0.5)';"""
         
     | 
| 
       1032 
1057 
     | 
    
         
             
                )
         
     | 
| 
       1033 
1058 
     | 
    
         
             
                try:
         
     | 
| 
       1034 
     | 
    
         
            -
                     
     | 
| 
      
 1059 
     | 
    
         
            +
                    execute_script(driver, script, element)
         
     | 
| 
       1035 
1060 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1036 
1061 
     | 
    
         
             
                    return
         
     | 
| 
       1037 
1062 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -1040,7 +1065,7 @@ def highlight_element_with_js_2(driver, message, element, o_bs, msg_dur): 
     | 
|
| 
       1040 
1065 
     | 
    
         
             
                    '0px 0px 6px 6px rgba(205, 30, 0, 1)';"""
         
     | 
| 
       1041 
1066 
     | 
    
         
             
                )
         
     | 
| 
       1042 
1067 
     | 
    
         
             
                try:
         
     | 
| 
       1043 
     | 
    
         
            -
                     
     | 
| 
      
 1068 
     | 
    
         
            +
                    execute_script(driver, script, element)
         
     | 
| 
       1044 
1069 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1045 
1070 
     | 
    
         
             
                    return
         
     | 
| 
       1046 
1071 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -1049,7 +1074,7 @@ def highlight_element_with_js_2(driver, message, element, o_bs, msg_dur): 
     | 
|
| 
       1049 
1074 
     | 
    
         
             
                    '0px 0px 6px 6px rgba(128, 0, 128, 1)';"""
         
     | 
| 
       1050 
1075 
     | 
    
         
             
                )
         
     | 
| 
       1051 
1076 
     | 
    
         
             
                try:
         
     | 
| 
       1052 
     | 
    
         
            -
                     
     | 
| 
      
 1077 
     | 
    
         
            +
                    execute_script(driver, script, element)
         
     | 
| 
       1053 
1078 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1054 
1079 
     | 
    
         
             
                    return
         
     | 
| 
       1055 
1080 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -1058,7 +1083,7 @@ def highlight_element_with_js_2(driver, message, element, o_bs, msg_dur): 
     | 
|
| 
       1058 
1083 
     | 
    
         
             
                    '0px 0px 6px 6px rgba(50, 50, 128, 1)';"""
         
     | 
| 
       1059 
1084 
     | 
    
         
             
                )
         
     | 
| 
       1060 
1085 
     | 
    
         
             
                try:
         
     | 
| 
       1061 
     | 
    
         
            -
                     
     | 
| 
      
 1086 
     | 
    
         
            +
                    execute_script(driver, script, element)
         
     | 
| 
       1062 
1087 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1063 
1088 
     | 
    
         
             
                    return
         
     | 
| 
       1064 
1089 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -1067,18 +1092,16 @@ def highlight_element_with_js_2(driver, message, element, o_bs, msg_dur): 
     | 
|
| 
       1067 
1092 
     | 
    
         
             
                    '0px 0px 6px 6px rgba(50, 205, 50, 1)';"""
         
     | 
| 
       1068 
1093 
     | 
    
         
             
                )
         
     | 
| 
       1069 
1094 
     | 
    
         
             
                try:
         
     | 
| 
       1070 
     | 
    
         
            -
                     
     | 
| 
      
 1095 
     | 
    
         
            +
                    execute_script(driver, script, element)
         
     | 
| 
       1071 
1096 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1072 
1097 
     | 
    
         
             
                    return
         
     | 
| 
       1073 
1098 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
       1074 
     | 
    
         
            -
                 
     | 
| 
      
 1099 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       1075 
1100 
     | 
    
         
             
                    activate_jquery(driver)
         
     | 
| 
       1076 
1101 
     | 
    
         
             
                    post_messenger_success_message(driver, message, msg_dur)
         
     | 
| 
       1077 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       1078 
     | 
    
         
            -
                    pass
         
     | 
| 
       1079 
1102 
     | 
    
         
             
                script = """arguments[0].style.boxShadow = '%s';""" % (o_bs)
         
     | 
| 
       1080 
1103 
     | 
    
         
             
                try:
         
     | 
| 
       1081 
     | 
    
         
            -
                     
     | 
| 
      
 1104 
     | 
    
         
            +
                    execute_script(driver, script, element)
         
     | 
| 
       1082 
1105 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1083 
1106 
     | 
    
         
             
                    return
         
     | 
| 
       1084 
1107 
     | 
    
         | 
| 
         @@ -1096,11 +1119,9 @@ def highlight_with_jquery_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       1096 
1119 
     | 
    
         
             
                    else:
         
     | 
| 
       1097 
1120 
     | 
    
         
             
                        early_exit = True  # Changing the box-shadow changes the selector
         
     | 
| 
       1098 
1121 
     | 
    
         
             
                    if early_exit:
         
     | 
| 
       1099 
     | 
    
         
            -
                         
     | 
| 
      
 1122 
     | 
    
         
            +
                        with suppress(Exception):
         
     | 
| 
       1100 
1123 
     | 
    
         
             
                            activate_jquery(driver)
         
     | 
| 
       1101 
1124 
     | 
    
         
             
                            post_messenger_success_message(driver, message, msg_dur)
         
     | 
| 
       1102 
     | 
    
         
            -
                        except Exception:
         
     | 
| 
       1103 
     | 
    
         
            -
                            pass
         
     | 
| 
       1104 
1125 
     | 
    
         
             
                        return
         
     | 
| 
       1105 
1126 
     | 
    
         
             
                script = (
         
     | 
| 
       1106 
1127 
     | 
    
         
             
                    """jQuery('%s').css('box-shadow',
         
     | 
| 
         @@ -1118,7 +1139,7 @@ def highlight_with_jquery_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       1118 
1139 
     | 
    
         
             
                    % selector
         
     | 
| 
       1119 
1140 
     | 
    
         
             
                )
         
     | 
| 
       1120 
1141 
     | 
    
         
             
                try:
         
     | 
| 
       1121 
     | 
    
         
            -
                     
     | 
| 
      
 1142 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       1122 
1143 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1123 
1144 
     | 
    
         
             
                    return
         
     | 
| 
       1124 
1145 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -1128,7 +1149,7 @@ def highlight_with_jquery_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       1128 
1149 
     | 
    
         
             
                    % selector
         
     | 
| 
       1129 
1150 
     | 
    
         
             
                )
         
     | 
| 
       1130 
1151 
     | 
    
         
             
                try:
         
     | 
| 
       1131 
     | 
    
         
            -
                     
     | 
| 
      
 1152 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       1132 
1153 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1133 
1154 
     | 
    
         
             
                    return
         
     | 
| 
       1134 
1155 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -1138,7 +1159,7 @@ def highlight_with_jquery_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       1138 
1159 
     | 
    
         
             
                    % selector
         
     | 
| 
       1139 
1160 
     | 
    
         
             
                )
         
     | 
| 
       1140 
1161 
     | 
    
         
             
                try:
         
     | 
| 
       1141 
     | 
    
         
            -
                     
     | 
| 
      
 1162 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       1142 
1163 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1143 
1164 
     | 
    
         
             
                    return
         
     | 
| 
       1144 
1165 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
         @@ -1148,20 +1169,18 @@ def highlight_with_jquery_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       1148 
1169 
     | 
    
         
             
                    % selector
         
     | 
| 
       1149 
1170 
     | 
    
         
             
                )
         
     | 
| 
       1150 
1171 
     | 
    
         
             
                try:
         
     | 
| 
       1151 
     | 
    
         
            -
                     
     | 
| 
      
 1172 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       1152 
1173 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1153 
1174 
     | 
    
         
             
                    return
         
     | 
| 
       1154 
1175 
     | 
    
         
             
                time.sleep(0.0181)
         
     | 
| 
       1155 
1176 
     | 
    
         | 
| 
       1156 
     | 
    
         
            -
                 
     | 
| 
      
 1177 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       1157 
1178 
     | 
    
         
             
                    activate_jquery(driver)
         
     | 
| 
       1158 
1179 
     | 
    
         
             
                    post_messenger_success_message(driver, message, msg_dur)
         
     | 
| 
       1159 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       1160 
     | 
    
         
            -
                    pass
         
     | 
| 
       1161 
1180 
     | 
    
         | 
| 
       1162 
1181 
     | 
    
         
             
                script = """jQuery('%s').css('box-shadow', '%s');""" % (selector, o_bs)
         
     | 
| 
       1163 
1182 
     | 
    
         
             
                try:
         
     | 
| 
       1164 
     | 
    
         
            -
                     
     | 
| 
      
 1183 
     | 
    
         
            +
                    execute_script(driver, script)
         
     | 
| 
       1165 
1184 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1166 
1185 
     | 
    
         
             
                    return
         
     | 
| 
       1167 
1186 
     | 
    
         | 
| 
         @@ -1169,25 +1188,35 @@ def highlight_with_jquery_2(driver, message, selector, o_bs, msg_dur): 
     | 
|
| 
       1169 
1188 
     | 
    
         
             
            def get_active_element_css(driver):
         
     | 
| 
       1170 
1189 
     | 
    
         
             
                from seleniumbase.js_code import active_css_js
         
     | 
| 
       1171 
1190 
     | 
    
         | 
| 
       1172 
     | 
    
         
            -
                 
     | 
| 
      
 1191 
     | 
    
         
            +
                if shared_utils.is_cdp_swap_needed(driver):
         
     | 
| 
      
 1192 
     | 
    
         
            +
                    return driver.cdp.get_active_element_css()
         
     | 
| 
      
 1193 
     | 
    
         
            +
                return execute_script(driver, active_css_js.get_active_element_css)
         
     | 
| 
       1173 
1194 
     | 
    
         | 
| 
       1174 
1195 
     | 
    
         | 
| 
       1175 
1196 
     | 
    
         
             
            def get_locale_code(driver):
         
     | 
| 
       1176 
1197 
     | 
    
         
             
                script = "return navigator.language || navigator.languages[0];"
         
     | 
| 
       1177 
     | 
    
         
            -
                return  
     | 
| 
      
 1198 
     | 
    
         
            +
                return execute_script(driver, script)
         
     | 
| 
      
 1199 
     | 
    
         
            +
             
     | 
| 
      
 1200 
     | 
    
         
            +
             
     | 
| 
      
 1201 
     | 
    
         
            +
            def get_screen_rect(driver):
         
     | 
| 
      
 1202 
     | 
    
         
            +
                return execute_script(driver, "return window.screen;")
         
     | 
| 
       1178 
1203 
     | 
    
         | 
| 
       1179 
1204 
     | 
    
         | 
| 
       1180 
1205 
     | 
    
         
             
            def get_origin(driver):
         
     | 
| 
       1181 
     | 
    
         
            -
                return  
     | 
| 
      
 1206 
     | 
    
         
            +
                return execute_script(driver, "return window.location.origin;")
         
     | 
| 
       1182 
1207 
     | 
    
         | 
| 
       1183 
1208 
     | 
    
         | 
| 
       1184 
1209 
     | 
    
         
             
            def get_user_agent(driver):
         
     | 
| 
       1185 
     | 
    
         
            -
                return  
     | 
| 
      
 1210 
     | 
    
         
            +
                return execute_script(driver, "return navigator.userAgent;")
         
     | 
| 
      
 1211 
     | 
    
         
            +
             
     | 
| 
      
 1212 
     | 
    
         
            +
             
     | 
| 
      
 1213 
     | 
    
         
            +
            def get_cookie_string(driver):
         
     | 
| 
      
 1214 
     | 
    
         
            +
                return execute_script(driver, "return document.cookie;")
         
     | 
| 
       1186 
1215 
     | 
    
         | 
| 
       1187 
1216 
     | 
    
         | 
| 
       1188 
1217 
     | 
    
         
             
            def get_scroll_distance_to_element(driver, element):
         
     | 
| 
       1189 
1218 
     | 
    
         
             
                try:
         
     | 
| 
       1190 
     | 
    
         
            -
                    scroll_position =  
     | 
| 
      
 1219 
     | 
    
         
            +
                    scroll_position = execute_script(driver, "return window.scrollY;")
         
     | 
| 
       1191 
1220 
     | 
    
         
             
                    element_location = None
         
     | 
| 
       1192 
1221 
     | 
    
         
             
                    element_location = element.location["y"]
         
     | 
| 
       1193 
1222 
     | 
    
         
             
                    element_location = element_location - constants.Scroll.Y_OFFSET
         
     | 
| 
         @@ -1228,9 +1257,9 @@ def scroll_to_element(driver, element): 
     | 
|
| 
       1228 
1257 
     | 
    
         
             
                # The old jQuery scroll_script required by=By.CSS_SELECTOR
         
     | 
| 
       1229 
1258 
     | 
    
         
             
                # scroll_script = "jQuery('%s')[0].scrollIntoView()" % selector
         
     | 
| 
       1230 
1259 
     | 
    
         
             
                # This other scroll_script does not centralize the element
         
     | 
| 
       1231 
     | 
    
         
            -
                #  
     | 
| 
      
 1260 
     | 
    
         
            +
                # execute_script(driver, "arguments[0].scrollIntoView();", element)
         
     | 
| 
       1232 
1261 
     | 
    
         
             
                try:
         
     | 
| 
       1233 
     | 
    
         
            -
                     
     | 
| 
      
 1262 
     | 
    
         
            +
                    execute_script(driver, scroll_script)
         
     | 
| 
       1234 
1263 
     | 
    
         
             
                    return True
         
     | 
| 
       1235 
1264 
     | 
    
         
             
                except Exception:
         
     | 
| 
       1236 
1265 
     | 
    
         
             
                    return False
         
     | 
| 
         @@ -1241,7 +1270,7 @@ def slow_scroll_to_element(driver, element, *args, **kwargs): 
     | 
|
| 
       1241 
1270 
     | 
    
         
             
                    # IE breaks on slow-scrolling. Do a fast scroll instead.
         
     | 
| 
       1242 
1271 
     | 
    
         
             
                    scroll_to_element(driver, element)
         
     | 
| 
       1243 
1272 
     | 
    
         
             
                    return
         
     | 
| 
       1244 
     | 
    
         
            -
                scroll_position =  
     | 
| 
      
 1273 
     | 
    
         
            +
                scroll_position = execute_script(driver, "return window.scrollY;")
         
     | 
| 
       1245 
1274 
     | 
    
         
             
                element_location_y = None
         
     | 
| 
       1246 
1275 
     | 
    
         
             
                try:
         
     | 
| 
       1247 
1276 
     | 
    
         
             
                    element_location_y = element.location["y"]
         
     | 
| 
         @@ -1271,12 +1300,12 @@ def slow_scroll_to_element(driver, element, *args, **kwargs): 
     | 
|
| 
       1271 
1300 
     | 
    
         
             
                        time.sleep(0.011)
         
     | 
| 
       1272 
1301 
     | 
    
         
             
                        new_position += step_value
         
     | 
| 
       1273 
1302 
     | 
    
         
             
                        scroll_script = "window.scrollTo(0, %s);" % new_position
         
     | 
| 
       1274 
     | 
    
         
            -
                         
     | 
| 
      
 1303 
     | 
    
         
            +
                        execute_script(driver, scroll_script)
         
     | 
| 
       1275 
1304 
     | 
    
         
             
                time.sleep(0.01)
         
     | 
| 
       1276 
1305 
     | 
    
         
             
                scroll_script = "window.scrollTo(%s, %s);" % (
         
     | 
| 
       1277 
1306 
     | 
    
         
             
                    element_location_x_fix, element_location_y
         
     | 
| 
       1278 
1307 
     | 
    
         
             
                )
         
     | 
| 
       1279 
     | 
    
         
            -
                 
     | 
| 
      
 1308 
     | 
    
         
            +
                execute_script(driver, scroll_script)
         
     | 
| 
       1280 
1309 
     | 
    
         
             
                time.sleep(0.01)
         
     | 
| 
       1281 
1310 
     | 
    
         
             
                if distance > 430 or distance < -300:
         
     | 
| 
       1282 
1311 
     | 
    
         
             
                    # Add small recovery time for long-distance slow-scrolling
         
     | 
| 
         @@ -1442,12 +1471,10 @@ def get_drag_and_drop_with_offset_script(selector, x, y): 
     | 
|
| 
       1442 
1471 
     | 
    
         | 
| 
       1443 
1472 
     | 
    
         | 
| 
       1444 
1473 
     | 
    
         
             
            def clear_out_console_logs(driver):
         
     | 
| 
       1445 
     | 
    
         
            -
                 
     | 
| 
      
 1474 
     | 
    
         
            +
                with suppress(Exception):
         
     | 
| 
       1446 
1475 
     | 
    
         
             
                    # Clear out the current page log before navigating to a new page
         
     | 
| 
       1447 
1476 
     | 
    
         
             
                    # (To make sure that assert_no_js_errors() uses current results)
         
     | 
| 
       1448 
1477 
     | 
    
         
             
                    driver.get_log("browser")
         
     | 
| 
       1449 
     | 
    
         
            -
                except Exception:
         
     | 
| 
       1450 
     | 
    
         
            -
                    pass
         
     | 
| 
       1451 
1478 
     | 
    
         | 
| 
       1452 
1479 
     | 
    
         | 
| 
       1453 
1480 
     | 
    
         
             
            def _jq_format(code):
         
     |