9

私は 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")

ここで、エラーが発生しました:

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

誰でもこの問題に取り組む方法を知っていますか? 前もって感謝します!

4

1 に答える 1

16

()その後webdriver.Firefox、実際にクラスのコンストラクターを呼び出してインスタンスを作成する必要があります。

于 2012-11-20T12:29:15.870 に答える