2017-09-06 1 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

그는 파이어 폭스의 자본 F에 대해 언급했다. –

+1

@ShubhamJain 그것은 효과가 있었다. 아야!! 그것은 20 % 더 많은 CPU를 사용합니다 !!! 그것은 적은 머리를 사용하지 않는 CPU를 사용합니다. Chrome이 10 %를 절약했습니다. –

0

당신의 파이어 폭스를 제거하고 아래 야간 버전을 설치 : -

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

당신은 너무 모든 레지스트리 항목이

그것은 당신을 도울 것입니다 희망 :

제거됩니다 파이어 폭스를 제거하기 위해 레보을 사용할 수 있습니다

+0

나는 아직도이 줄에 문제가있는 것 같다. driver = webdriver.firefox (firefox_options = options). –

관련 문제