2017-06-26 8 views
0

python27 selenium firefox webdriverで設定をしようとしています(許可されたフラッシュから開始する必要があるため)。これは、イムは、優先順位を設定しようとしていない場合は動作します私の非作業コードです:Webdriverオブジェクトには、Python27のFirefox Webdriverの属性set_preferenceエラーがありません。Selenium

import pyautogui, sys 
import time 
import random 
import subprocess 
from selenium import webdriver 
from selenium.webdriver.firefox.options import Options 
driver = webdriver.Firefox(('C:\\Users\\administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\0atm5xlq.default-1401786267631')) 
driver.set_preference("plugin.state.flash", 2) 

答えて

1

webdriverをオブジェクトが

SET_PREFERENCE何の属性を持っていないset_preferenceFirefoxProfileオブジェクト内で定義されているためです。

profile = webdriver.FirefoxProfile(<path-to-profile>) 
profile.set_preference("plugin.state.flash", 2) 

driver = webdriver.Firefox(profile) 
関連する問題