I'm on Windows, and I want to launch Firefox and the Selenium IDE with a specified test case loaded and ready to play back.
我在Windows上,我想启动Firefox和Selenium IDE,并加载指定的测试用例并准备回放。
I've got as far as:
我到目前为止:
>"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content"
which launches Firefox and the IDE, but I don't know enough about the Selenium IDE or Chrome to get any further. I'd expect something like:
它推出了Firefox和IDE,但我不太了解Selenium IDE或Chrome进一步了解。我希望有类似的东西:
>"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content?test=foo.html"
to be supported, but I can't find the right incantation.
得到支持,但我找不到正确的咒语。
As background, I'm generating test case templates from a Swing application and want to just punt them into Firefox for modification and execution with a single button-press. If there's an easier way to do that than Runtime.getRuntime.exec(theAbove) then I'm all ears.
作为背景,我正在从Swing应用程序生成测试用例模板,并希望只需将它们插入Firefox即可通过单个按钮进行修改和执行。如果有一个比Runtime.getRuntime.exec(theAbove)更简单的方法,那么我全都听见了。
2 个解决方案
#1
9
You are close. Selenium has a built-in page to auto load and execute tests from a test-suite called TestRunner.html. You can invoke it like follows :
你很亲密Selenium有一个内置页面,可以从名为TestRunner.html的测试套件中自动加载和执行测试。您可以像下面这样调用它:
C:\Program Files\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content/selenium-core/TestRunner.html?baseUrl=http://[BASEURL]&test=file:///[TESTSUITE-PATH]&auto=false"
This will fireup firefox with all tests from the test-suite at the specified path loaded up and waiting to execute in a single button press.
这将启动firefox,并在指定的路径上从测试套件中加载所有测试并等待按下单个按钮执行。
For example
例如
After creating a couple of selenium tests, save the test cases as testcase1.html and testcase2.html in a folder say c:\tests.
在创建了几个selenium测试后,将测试用例保存为testcase1.html和testcase2.html在一个文件夹中说c:\ tests。
Save the test suite as testsuite.html in the same folder. Now you can launch these suite of tests with the below command line :
将测试套件保存为testsuite.html在同一文件夹中。现在,您可以使用以下命令行启动这些测试套件:
C:\Program Files\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content/selenium-core/TestRunner.html?baseUrl=http://localhost&test=file:///C:\tests\testsuite.html&auto=false"
You should have the tests loaded up in firefox ready to execute.
您应该在firefox中加载测试,以便执行。
If you change the above url to have auto parameter to true, then it will run the tests as well after launch.
如果更改上面的url使auto参数为true,那么它将在启动后运行测试。
&auto=true
EDIT :
编辑:
Updated baseurl argument to proper case sensitive form: baseUrl
将baseurl参数更新为正确的区分大小写的形式:baseUrl
Updated path to TestRunner.html to: chrome://selenium-ide/content/selenium-core/TestRunner.html
将TestRunner.html的更新路径更新为:chrome://selenium-ide/content/selenium-core/TestRunner.html
#2
6
If you want to run a testsuite with firefox from the commandline, you have to start run java, not firefox. Like this:
如果你想从命令行使用firefox运行一个testsuite,你必须开始运行java,而不是firefox。喜欢这个:
C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar c:\seltest\selenium-server-standalone-2.18.0.jar -htmlSuite "*firefox" "http://127.0.0.1" "c:\seltest\mytestsuite.html" "c:\seltest\logs\results-firefox.html" -port 5555
-- Freek Borgerink
- Freek Borgerink
#1
9
You are close. Selenium has a built-in page to auto load and execute tests from a test-suite called TestRunner.html. You can invoke it like follows :
你很亲密Selenium有一个内置页面,可以从名为TestRunner.html的测试套件中自动加载和执行测试。您可以像下面这样调用它:
C:\Program Files\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content/selenium-core/TestRunner.html?baseUrl=http://[BASEURL]&test=file:///[TESTSUITE-PATH]&auto=false"
This will fireup firefox with all tests from the test-suite at the specified path loaded up and waiting to execute in a single button press.
这将启动firefox,并在指定的路径上从测试套件中加载所有测试并等待按下单个按钮执行。
For example
例如
After creating a couple of selenium tests, save the test cases as testcase1.html and testcase2.html in a folder say c:\tests.
在创建了几个selenium测试后,将测试用例保存为testcase1.html和testcase2.html在一个文件夹中说c:\ tests。
Save the test suite as testsuite.html in the same folder. Now you can launch these suite of tests with the below command line :
将测试套件保存为testsuite.html在同一文件夹中。现在,您可以使用以下命令行启动这些测试套件:
C:\Program Files\Mozilla Firefox\firefox.exe" -chrome "chrome://selenium-ide/content/selenium-core/TestRunner.html?baseUrl=http://localhost&test=file:///C:\tests\testsuite.html&auto=false"
You should have the tests loaded up in firefox ready to execute.
您应该在firefox中加载测试,以便执行。
If you change the above url to have auto parameter to true, then it will run the tests as well after launch.
如果更改上面的url使auto参数为true,那么它将在启动后运行测试。
&auto=true
EDIT :
编辑:
Updated baseurl argument to proper case sensitive form: baseUrl
将baseurl参数更新为正确的区分大小写的形式:baseUrl
Updated path to TestRunner.html to: chrome://selenium-ide/content/selenium-core/TestRunner.html
将TestRunner.html的更新路径更新为:chrome://selenium-ide/content/selenium-core/TestRunner.html
#2
6
If you want to run a testsuite with firefox from the commandline, you have to start run java, not firefox. Like this:
如果你想从命令行使用firefox运行一个testsuite,你必须开始运行java,而不是firefox。喜欢这个:
C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar c:\seltest\selenium-server-standalone-2.18.0.jar -htmlSuite "*firefox" "http://127.0.0.1" "c:\seltest\mytestsuite.html" "c:\seltest\logs\results-firefox.html" -port 5555
-- Freek Borgerink
- Freek Borgerink