2017-09-06 10 views
2

私はSeleniumでヘッドレスFirefoxを実行しようとしています。以下の私のコードは次のとおりです。firefoxヘッドレスの問題を実行する

selenium.webdriver.firefox.options import Options 

from selenium import webdriver 
from selenium.webdriver.firefox.options import Options 
options = Options() 
options.add_argument('--headless') 
options.add_argument('--hide-scrollbars') 
options.add_argument('--disable-gpu') 
driver = webdriver.firefox(firefox_options = options) 

driver.get('https://wtfismyip.com') 
print(driver.find_element_by_tag_name('body').text) 

それは私を与え続けて:

driver = webdriver.firefox(firefox_options = options) 
TypeError: 'module' object is not callable 

私はクロームでは問題がなかったしています。

答えて

2

誤植をしました。

ドライバ= webdriver.Firefox(firefox_optionsの=オプション) 注資本F.

今では動作するはずです。

+0

同じ問題が続く:| | –

+0

彼は言ったFirefoxの資本金 –

+1

@ ShubhamJainそれは働いた。大好き!それは20%多くのCPUを使用します!それはヘッドレスを使用しないためにCPUを少なくしています。 Chromeが10%を保存しました –

0

あなたのFirefoxをアンインストールし、以下のように夜間のバージョンをインストールします -

https://www.mozilla.org/en-US/firefox/channel/desktop/

Firefoxをアンインストールするためにレボを使用することができますので、すべてのレジストリエントリが

が、それはあなたを助けることを願っています削除されます:)

+0

私はまだこの行に問題があるようです - driver = webdriver.firefox(firefox_options = options)。 –

関連する問題