|
9 | 9 | from selenium.common.exceptions import WebDriverException |
10 | 10 | from selenium.webdriver.common.desired_capabilities import DesiredCapabilities |
11 | 11 | from seleniumbase.config import proxy_list |
| 12 | +from seleniumbase.config import settings |
12 | 13 | from seleniumbase.core import download_helper |
13 | 14 | from seleniumbase.core import proxy_helper |
14 | 15 | from seleniumbase.core import capabilities_parser |
@@ -150,12 +151,16 @@ def _create_firefox_profile(downloads_path, proxy_string): |
150 | 151 | def display_proxy_warning(proxy_string): |
151 | 152 | message = ('\n\nWARNING: Proxy String ["%s"] is NOT in the expected ' |
152 | 153 | '"ip_address:port" or "server:port" format, ' |
153 | | - '(OR the key does not exist in proxy_list.PROXY_LIST). ' |
154 | | - '*** DEFAULTING to NOT USING a Proxy Server! ***' |
| 154 | + '(OR the key does not exist in ' |
| 155 | + 'seleniumbase.config.proxy_list.PROXY_LIST).' |
155 | 156 | % proxy_string) |
156 | | - warnings.simplefilter('always', Warning) # See Warnings |
157 | | - warnings.warn(message, category=Warning, stacklevel=2) |
158 | | - warnings.simplefilter('default', Warning) # Set Default |
| 157 | + if settings.RAISE_INVALID_PROXY_STRING_EXCEPTION: |
| 158 | + raise Exception(message) |
| 159 | + else: |
| 160 | + message += ' *** DEFAULTING to NOT USING a Proxy Server! ***' |
| 161 | + warnings.simplefilter('always', Warning) # See Warnings |
| 162 | + warnings.warn(message, category=Warning, stacklevel=2) |
| 163 | + warnings.simplefilter('default', Warning) # Set Default |
159 | 164 |
|
160 | 165 |
|
161 | 166 | def validate_proxy_string(proxy_string): |
|
0 commit comments