简体   繁体   English

使用Maven进行硒RC测试

[英]Selenium RC testing with Maven

I'm trying to run a series of selenium tests using maven and I get this error: 我正在尝试使用Maven运行一系列硒测试,但出现此错误:

Running com.myapp.web.selenium.MySeleniumTest
WARN  [SocketListener0-1] HttpConnection - POST /selenium-server/driver/ HTTP/1.1
java.lang.RuntimeException: Firefox refused shutdown while preparing a profile
        at org.openqa.selenium.server.browserlaunchers.FirefoxCustomProfileLauncher.waitForFullProfileToBeCreated(FirefoxCustomProfileLauncher.java:27
7)
        at org.openqa.selenium.server.browserlaunchers.FirefoxCustomProfileLauncher.launch(FirefoxCustomProfileLauncher.java:147)
        at org.openqa.selenium.server.browserlaunchers.AbstractBrowserLauncher.launchRemoteSession(AbstractBrowserLauncher.java:24)
        at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:587)
        .............
Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxCustomProfileLauncher$FileLockRemainedException: Lock file still present! C:\DOCUME~1\Fl
orin\LOCALS~1\Temp\customProfileDir894171\parent.lock
        at org.openqa.selenium.server.browserlaunchers.FirefoxCustomProfileLauncher.waitForFileLockToGoAway(FirefoxCustomProfileLauncher.java:235)
        at org.openqa.selenium.server.browserlaunchers.FirefoxCustomProfileLauncher.waitForFullProfileToBeCreated(FirefoxCustomProfileLauncher.java:27

I'm using Firefox 3.6.8, selenium-java-client-driver 0.9.2 and selenium-server 0.9.2. 我正在使用Firefox 3.6.8,selenium-java-client-driver 0.9.2和selenium-server 0.9.2。 I start the selenium server from the tests like this: 我从这样的测试中启动硒服务器:

private static void initServer() throws Exception {
    String[] args = new String[]{"-port", String.valueOf(4444)};
    SeleniumServer.main(args);
}

It seems that the selenium profile is being locked and not released so that the subsequent tests can use it. 似乎硒概要文件已被锁定且未释放,以便后续测试可以使用它。

I had problems with the mvn selenium:selenese maven goal. 我对mvn硒:塞伦式maven目标有疑问。

I discard using it because I think the selenium maven plugin comes with and older version of selenium RC. 我放弃使用它是因为我认为selenium maven插件是与旧版本的selenium RC一起提供的。

The solution for me was to use the last Selenium RC release running outside maven as a standalone server and I run selenium tests as integration-tests 对我来说,解决方案是将在maven外部运行的最新Selenium RC版本用作独立服务器,并将硒测试作为集成测试运行

Can't speak on specifics, but I can relate I had some issues with Selenium tests on Firefox 3.6.(forget the version). 不能说具体细节,但是我可以说我在Firefox 3.6上进行Selenium测试时遇到了一些问题(忘记版本)。 When I reverted to the last 3.5 release, it worked as usual. 当我恢复到最新的3.5版本时,它照常工作。 If going back to an older firefox is not a big deal, might be worth a shot. 如果回到较旧的Firefox没什么大不了的,可能值得一试。 Otherwise, not sure. 否则,不确定。

The version of Selenium that you are using is actually quite old. 您正在使用的Selenium版本实际上已经很旧了。 Have you tried using the Selenium Maven plugin instead? 您是否尝试过使用Selenium Maven插件? In my experience, Selenium has often needed to be upgraded to accommodate newer versions of browsers. 以我的经验,Selenium经常需要升级以适应较新版本的浏览器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM