Selenium/Python:TypeError:undound方法get()

ale*_*lex 9 selenium python-2.7 selenium-webdriver

我是Selenium的Python新手.我试着测试我的第一个python/selenium代码并得到一个错误.

from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
import time

# Create a new instance of the Firefox driver
driver = webdriver.Firefox

# go to the google home page
driver.get("http://www.google.com")
Run Code Online (Sandbox Code Playgroud)

在这里,我有错误:

**TypeError:unbound method get() must be called with Webdriver instance as first argument (got str instance instead)**
Run Code Online (Sandbox Code Playgroud)

有人知道如何解决这个问题吗?提前致谢!

Woo*_*ble 16

你需要()经过webdriver.Firefox实际调用类的构造函数,并创建一个实例.