今天写个自动刷新页面的脚本,发现在启动firefox的时候,出现一个类似如下的错误:
请在文本框输入文字15:22:12.031 WARN - GET /selenium-server/driver/?cmd=getNewBrowserSession&1=*fir efox&2=http://www.google.com HTTP/1.1 java.lang.RuntimeException: Firefox refused shutdown while preparing a profile at org.openqa.selenium.server.browserlaunchers.FirefoxCustomProfileLaunc her.waitForFullProfileToBeCreated(FirefoxCustomProfileLauncher.java:277) |
后来查了google发现问题是selenium不支持高版本firefox, 解决方案如下:
1、用winrar打开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>3.5.*</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>3.6.*</em:maxVersion> </Description> </em:targetApplication> |
还可以改得更加大,那么就可以支持4.0 的firefox了