-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeUndetected Chromedriver Mode / CDP Modeworkaround existsYou can reach your destination if you do this...You can reach your destination if you do this...
Description
"SyntaxError: Illegal return statement" may happen on sb.cdp.evaluate(expression)
Simple steps to reproduce:
script = (
f"""
function getSomeValue() {{
return '42';
}}
return getSomeValue();
"""
)
data = sb.cdp.evaluate(script)
The workaround for now is to remove the final return
statement. (Eg. Replace return getSomeValue();
with getSomeValue()
):
script = (
f"""
function getSomeValue() {{
return '42';
}}
getSomeValue();
"""
)
data = sb.cdp.evaluate(script)
That's because sb.cdp.evaluate(expression)
expects a natural expression
(with no return
).
Pranoy1c
Metadata
Metadata
Assignees
Labels
UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeUndetected Chromedriver Mode / CDP Modeworkaround existsYou can reach your destination if you do this...You can reach your destination if you do this...