0

I am trying access js variables from a website and I am doing something like this:

log = driver.execute_script(""" return v1,v2; """)
print log

where driver = webdriver.Chrome()

It is returning only the value for v2 variable but not the v1.

Is there any way I can return more than one variable and store it into a list ?

1 Answer 1

1

You need to wrap the values with brackets

log = driver.execute_script(""" return [v1, v2]; """)
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, it worked. I tried using return (v1,v2); earlier but that didn't work, any thoughts ?
Okay, got it javascript doesn't support that. Thanks again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.