简体   繁体   中英

Name driver is not defined for selenium

this is the error which i have got when executed the code

and the code is

import selenium
from selenium import webdriver
webdriver.Firefox()
driver.get("http://google.com")

You have to define the variable driver before using it. It should look something like this:

from selenium import webdriver
driver = webdriver.Firefox(path_to_driver_dir)
driver.get("http://google.com")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM