Skip to content

Commit f28c1b1

Browse files
committed
Improve error-handling with UC Mode
1 parent 7dd35c5 commit f28c1b1

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

seleniumbase/undetected/__init__.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -330,18 +330,23 @@ def __dir__(self):
330330
return object.__dir__(self)
331331

332332
def _get_cdc_props(self):
333-
return self.execute_script(
334-
"""
335-
let objectToInspect = window,
336-
result = [];
337-
while(objectToInspect !== null)
338-
{ result = result.concat(
339-
Object.getOwnPropertyNames(objectToInspect)
340-
);
341-
objectToInspect = Object.getPrototypeOf(objectToInspect); }
342-
return result.filter(i => i.match(/^[a-z]{3}_[a-z]{22}_.*/i))
343-
"""
344-
)
333+
cdc_props = []
334+
try:
335+
cdc_props = self.execute_script(
336+
"""
337+
let objectToInspect = window,
338+
result = [];
339+
while(objectToInspect !== null)
340+
{ result = result.concat(
341+
Object.getOwnPropertyNames(objectToInspect)
342+
);
343+
objectToInspect = Object.getPrototypeOf(objectToInspect); }
344+
return result.filter(i => i.match(/^[a-z]{3}_[a-z]{22}_.*/i))
345+
"""
346+
)
347+
except Exception:
348+
pass
349+
return cdc_props
345350

346351
def _hook_remove_cdc_props(self, cdc_props):
347352
if len(cdc_props) < 1:

0 commit comments

Comments
 (0)