## 其它
### firefox代理
```
String PROXY = "localhost:8080";//如果不是本機,localhost替換成IP地址
org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(PROXY)
.setFtpProxy(PROXY)
.setSslProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabailities();
cap.setPreference(CapabilityType.PROXY, proxy);
WebDriver driver = new FirefoxDriver(cap);
```
### 啟用firefox禁用的功能
```
FirefoxProfile profile = new FirefoxProfile();
profile.setEnableNativeEvents(true);
WebDriver driver = new FirefoxDriver(profile);
```
### 臨時指定插件
有時需要臨時讓啟動的firefox帶一個插件,如firebug,來定位問題等。首先要下載這個插件的xpi安裝包。剩下的就讓selenium webdriver來完成,如下:
```
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.addExtension(file);
//避免啟動畫面
firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.10.1");
WebDriver driver = new FirefoxDriver(firefoxProfile);
```