Java Reference
In-Depth Information
Table 12.2
Selenium browser launcher strings
(continued)
SeleneseTestCase
and
DefaultSelenium
browser strings
Web browser
Firefox Chrome URL
15
*chrome
Internet Explorer
*iexplore
Internet Explorer HTML
application
16
*iehta
Internet Explorer
*iexploreproxy
Opera
*opera
Safari
*safari
Specific executable
c:\\path\\to\\a\\browser.exe”
If you don't call
SeleneseTestCase
's
setUp(String,String)
, the default web browser
launch string used on Windows is
*iexplore
, and it's
*firefox
for all other operating
systems. If you use the class
DefaultSelenium
, you must provide a browser launch
string, for example:
1516
selenium = new DefaultSelenium("localhost", 4444, "*iexplore",
Note that experimental
17
browser launchers exist for elevated security privileges and
proxy injection.
12.8.2
Testing multiple browsers
We can apply the same
JU
nit
@Parameterized
feature we used with HtmlUnit in order
to run the same test class with more than one browser. In listing 12.16, we rework our
previous example with class-level and instance-level
JU
nit initialization in order to
combine the ability to run all tests with one client driver instance and then repeat the
test for different browsers.
Listing 12.16
Running the test class for multiple browsers
[File 1]
@RunWith(ManagedSeleniumServerSuite.class)
@SuiteClasses({UnmanagedAllBrowsersTest.class})
public class
ManagedAllBrowsersSuiteTest {}
15
Chrome URL:
https://developer.mozilla.org/En/XUL
16
IE HTML application:
http://msdn.microsoft.com/en-us/library/ms536496(
VS.85).aspx
17
Experimental browser launchers:
http://seleniumhq.org/documentation/remote-control/experimental.html