Skip to content

Commit c8eac6e

Browse files
committed
Add "ProxyConnectionException" with a retry
1 parent eb57c34 commit c8eac6e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

seleniumbase/common/exceptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
NotUsingChromeException => Used by Chrome-only methods if not using Chrome.
66
NotUsingChromiumException => Used by Chromium-only methods if not Chromium.
77
OutOfScopeException => Used by BaseCase methods when setUp() is skipped.
8+
ProxyConnectionException => Called when the proxy connection failed.
89
TextNotVisibleException => Called when expected text fails to appear.
910
TimeLimitExceededException => Called when exceeding "--time-limit=SECONDS".
1011
TimeoutException => Called when some timeout limit has been exceeded.
@@ -36,6 +37,10 @@ class OutOfScopeException(Exception):
3637
pass
3738

3839

40+
class ProxyConnectionException(Exception):
41+
pass
42+
43+
3944
class TextNotVisibleException(Exception):
4045
pass
4146

seleniumbase/fixtures/base_case.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def test_anything(self):
6565
NotConnectedException,
6666
NotUsingChromeException,
6767
NotUsingChromiumException,
68+
ProxyConnectionException,
6869
OutOfScopeException,
6970
VisualException,
7071
)
@@ -261,6 +262,7 @@ def open(self, url):
261262
elif (
262263
"ERR_INTERNET_DISCONNECTED" in e.msg
263264
or "neterror?e=dnsNotFound" in e.msg
265+
or "ERR_PROXY_CONNECTION_FAILED" in e.msg
264266
):
265267
shared_utils.check_if_time_limit_exceeded()
266268
self.__check_browser()
@@ -272,8 +274,13 @@ def open(self, url):
272274
"ERR_INTERNET_DISCONNECTED" in e2.msg
273275
or "neterror?e=dnsNotFound" in e2.msg
274276
):
275-
message = "Internet unreachable!"
277+
message = "ERR_INTERNET_DISCONNECTED: "
278+
message += "Internet unreachable!"
276279
raise NotConnectedException(message)
280+
elif "ERR_PROXY_CONNECTION_FAILED" in e2.msg:
281+
message = "ERR_PROXY_CONNECTION_FAILED: "
282+
message += "Internet unreachable and/or invalid proxy!"
283+
raise ProxyConnectionException(message)
277284
else:
278285
raise
279286
elif "Timed out receiving message from renderer" in e.msg:

0 commit comments

Comments
 (0)