基于selenium測試firefox頁面内容,發現跑測試腳本的時候selenium sever 總是hang在
Preparing Firefox profile...這裡就不動了,firefox啟動不了,測試腳本也遲遲不能運作。
我用的是selenium-remote-control-1.0.1-dist這個版本,
google下發現問題是selenium不支援高版本firefox, 解決方案如下:
1、用winrar或7ZIP打開selenium-server.jar;
2、查找兩個目錄:customProfileDirCUSTFFCHROME和customProfileDirCUSTFF;
3、搜尋每個目錄,對每個檔案install.rdf,編輯如下行:
修改
<!-- Firefox -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.4.1</em:minVersion>
<em:maxVersion>4.*</em:maxVersion>
</Description>
</em:targetApplication>
為
<!-- Firefox -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.4.1</em:minVersion>
<em:maxVersion>4.*</em:maxVersion>
</Description>
</em:targetApplication>
還可以改得更加大,那麼就可以支援更高的firefox版本了。改完後firefox被成功啟動。