V
V
VKR2282021-01-28 22:30:19
Python
VKR228, 2021-01-28 22:30:19

Global variable 'driver' is undefined at the module level how to fix error?

the code

def browser():
    driver = webdriver.Chrome(info.road)
    global driver

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alan Gibizov, 2021-01-28
@phaggi

you need to declare a variable at the module level, like this:

driver = None

def browser():
    global driver
    driver = webdriver.Chrome(info.road)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question