我使用selenium独立版本2.33.0来运行自动化测试用例。直到上个月才运行良好。然后firefox版本是21.x.现在它升级到ver-22。
我发现selenium 2.33不适用于最新的firefox浏览器。所以我在下面的文件中将'maxVersion'的值更改为'23 .0。*': ./customProfileDirCUSTFF/extensions/readystate@openqa.org/install.rdf ./customProfileDirCUSTFF/extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf ./customProfileDirCUSTFFCHROME/extensions/readystate@openqa.org/install.rdf ./customProfileDirCUSTFFCHROME/extensions/{503A0CD4-EDC8-489b-853B-19E0BAA8F0A4}/install.rdf ./customProfileDirCUSTFFCHROME/extensions/ {538F0036-F358-4f84-A764-89FB437166B4} /install.rdf
在此之后,当我尝试运行selenium时,我收到以下错误:
Could not contact Selenium Server; have you started it on 'localhost:4444' ? Read more at http://seleniumhq.org/projects/remote-control/not-started.html Connection refused
com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:86)
at qa.apigee.common.ApigeeOnlineUITestBase.launchBrowser(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:640)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:503)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:193)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:123)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:183)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:115)
at org.testng.TestRunner.runWorkers(TestRunner.java:1098)
at org.testng.TestRunner.privateRun(TestRunner.java:727)
at org.testng.TestRunner.run(TestRunner.java:581)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:315)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:310)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:272)
at org.testng.SuiteRunner.run(SuiteRunner.java:221)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:40)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
at org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:151)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
请帮忙!
答案 0 :(得分:2)
尝试添加以下代码以启动服务器。
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://www.google.com/");
selenium.start();
}
希望这能解决您的问题。
答案 1 :(得分:0)
-jar selenium-server-standalone-2.42.2 jar -port 1234 - > apply->运行
完成此操作后,在程序中将端口号更改为1234 ..保存程序并运行
答案 2 :(得分:0)
启动服务器是必要的: 您应该转到Selenium RC服务器所在的目录,并从命令行控制台运行以下命令:
java -jar selenium-server-standalone-.jar
您还可以在Windows上创建一个.bat,在Linux上创建.sh。
来源:运行selenium服务器(http://www.seleniumhq.org/docs/05_selenium_rc.jsp)