以上的代碼在windows 和 OSX 上都工作正常。壞消息是,對于Java , C# 和Python 的coder 來說,看上去現在Java版本的webdriver還不支持設定chrome 的屬性。 你最好是基于現有的FirefoxProfile 類來創建一個ChromeProfile 類。
Scroll to a button before clicking it.
滾動到相應的button后才點擊
Clicking buttons sometimes randomly fail. It could be caused by the fact that the button is out of the view area at the moment you command selenium to click it. One way to address it is to always scroll to it before clicking it.
點擊button有時候會無故失敗,這可能是由于selenium 執行點擊命令的時候,這個button在視圖之外。所以解決這個問題的其中一個方法是,滾動到相應的button后才點擊。