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();') 

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.