Skip to content

Commit 025e647

Browse files
committed
Fix a bug in CDP Mode
1 parent 6e0c8c5 commit 025e647

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

seleniumbase/undetected/cdp_driver/element.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,15 @@ async def apply(self, js_function, return_by_value=True):
438438
)
439439
)
440440
)
441-
if result and result[0]:
442-
if return_by_value:
443-
return result[0].value
444-
return result[0]
445-
elif result[1]:
446-
return result[1]
441+
try:
442+
if result and result[0]:
443+
if return_by_value:
444+
return result[0].value
445+
return result[0]
446+
elif result[1]:
447+
return result[1]
448+
except Exception:
449+
return self
447450

448451
async def get_position_async(self, abs=False) -> Position:
449452
if not self.parent or not self.object_id:

0 commit comments

Comments
 (0)