seleniumを使ったとき

Pythonバインディング
sudo apt-get install python-setuptools してから
sudo pip install -U selenium

実行するサイトの動作が遅い時
http://softwaretest.jp/labo/tech/labo-294/
でExplicit waitをかける必要があるかもしれない
よくelement = WebDriverWait~~~と例が出るが、WebDriverWaitで指定されているelementが代入される(代入されるのをしばらく待つ、という意味)
代入なしだと、ただ単に待つだけかな
(公式に近いページ
https://selenium-python.readthedocs.org/waits.html
には,WebDriverWait by default calls the ExpectedCondition every 500 milliseconds until it returns successfully.とある)

見つからなかった場合、

アラートが出る時
http://www.yoheim.net/blog.php?q=20111102
例外を拾って、driver.switchTo().alert()してdismissなりacceptする
…と思ったけど、「switch_to_alertすればよい?」
http://stackoverflow.com/questions/19003003/check-if-any-alert-exists-using-selenium-with-python


随時このページを参考にしよう
https://selenium-python.readthedocs.org/


Google Chromeでやる時
Macだと何故かFirefoxで動かせなかった)
WebDriverをインストールした上で,直接指定する

class WebDriver :
    def __init__(self) :
        self.driver = webdriver.Chrome("/path_to_programs/chromedriver")

「サポートされていないコマンドライン フラグ --ignore-certificate-error を使用しています。これにより、安全性とセキュリティが損なわれます。」と警告が出る
http://chrome.half-moon.org/43.html#qd1d616c
変なところで動かさないように気をつけよう