
Seleniumのテストをするとき、「ブラウザのどんな設定が変更できるのか?」が気になったので、オプションの変更の仕方と、標準で備えているパラメータ一覧の見方をまとめました。
目次
Preference一覧の確認
アドレスバーに「about:config」と入力し、”すべてを表示”をクリック

↓

警告が出る場合
下記のような警告が出る場合、「危険性を承知の上で使用する」をクリック

Preferenceを変えてみる
実際に設定を変えてみます。
FireFoxはPDFのリンクをクリックしたとき、デフォルトで内部ビューワーで表示しますが、表示させずダウンロードさせるよう変更します。
変更にはFireFoxProfileを使います。
ソース
import os
from selenium import webdriver
from selenium.webdriver import FirefoxProfile
#Referenceの変更
profile = FirefoxProfile()
profile.set_preference("pdfjs.disabled",True)
driver = webdriver.Firefox(executable_path=os.getcwd() + "\\webdriver\\geckodriver.exe",firefox_profile=profile)
#IPAからWAF読本PDFをダウンロードする
driver.get("https://www.ipa.go.jp/security/vuln/waf.html")
driver.find_element_by_xpath('//*[@id="ipar_main"]/div/div/div[3]/table/tbody/tr/td[2]/ul[1]/li/a').click()
「set_preference」に変更したいPreferenceと値を指定すればOK
Referenceが変更されることを確認
about:configにアクセスして確認します。FirefoxProfileを使わずSeleniumを実行したときと、浸かって実行したときのブラウザで下記のような違いが出ます。
FirefoxProfileを使わなかったとき

FireFoxを使ったとき

まとめ
Referenceの一覧を見れるのは良いものの、それぞれのパラメータが何を意味するのか、取りまとめているサイトもなく、ちょっとわかりづらい印象。
また新規に追加することで効果を発揮する(標準の一覧に表示されていない)ものもあるので、そこも個人的に調べにくいですね。。。