2011-06-29 19 views
1

我想用Selenium RC设置自动java测试。由于我的网站使用的是https,因此在测试开始运行之前,我需要删除一个令人讨厌的证书弹出窗口。我想trustAllSSLCertificates与* pifirefox结合将是一个不错的主意,因此加入的pom.xml如下:用maven运行Selenium RC - 拥有https站点的证书问题

 <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>selenium-maven-plugin</artifactId> 
      <version>1.1</version> 
      <configuration> 
       <trustAllSSLCertificates>true</trustAllSSLCertificates> 
       <firefoxProfileTemplate>C:/Users/me/AppData/Roaming/Mozilla/Firefox/Profiles</firefoxProfileTemplate> 
      </configuration> 
      <executions> 
       <execution> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>start-server</goal> 
        </goals> 
        <configuration> 
         <background>true</background> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

正如你所看到的,我也创造了在那里我增加了网站的Firefox配置文件。尽管如此,Firefox仍然没有运行我的特殊配置文件,但每次都有新的配置文件。此外,只要添加证书,测试就会正常运行。

谢谢! Jay

+0

嗨那里Jay,我强烈推荐看一下[Selenium 2和Web Driver](http://seleniumhq.org/docs/03_webdriver.html)。我的团队遇到了几个不同的问题,使用Selenium RC关于启动浏览器(无论是不是无所谓)。也许这个问题已经在Selenium 2中解决了? – Caps

回答

0

除非您指定骨架配置文件(并且将其设置为“小”),否则Selenium将创建一个新的配置文件。

我真正做的是创建单独的Firefox配置文件,并根据使用的证书命名它们。然后我让测试代码得到适当的selenium/web驱动程序实例。