1

I use below code to execute javascript, and it works well.

from selenium import webdriver

driver=webdriver.Firefox()
driver.get("https:example.com")
driver.execute_script('isLogin()')

But when I try to access the result return by isLogin() with

isLogin = driver.execute_script('isLogin()')
print(isLogin)    # always None
0

1 Answer 1

2

You need to return the value returned by isLogin()

isLogin = driver.execute_script('return isLogin();')
Sign up to request clarification or add additional context in comments.

Comments

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.