English 中文(简体)
Setup for IE6 (and multiple browsers) in Selenium Grid
原标题:

I m having a hard time trying to grasp some concepts on selenium Grid/RC. What I need is to provide specific environments (ie6-on-xp, ie7-on-xp, etc) to the tests. For what I ve been reading, the browser line in grid_configuration.yml do not make any reference of what version of MSIE or Firefox I m running. So I can t get my head around in which form I can tell Grid/RC that I want some specific browsers and the path to run them (how RC knows which exe to run?)

Second, I d like to run portable versions of those browsers. I ve only seen that specified in the tests, and not in the RC s command line to run them. That is the way to do it, per test?

问题回答

I will answer your question by breaking up the info that you need

What I need is to provide specific environments (ie6-on-xp, ie7-on-xp, etc) to the tests.

Well since you can t have multiple IE instances on the same machine, I know there are apps that allow you to do that but in my experience they cause more issues than solving them. Ideally you want different machines to run the tests. By doing this you are also setting up a selenium farm for your devs to use because they can target a test at a specific instance. So setting up Grid as an Infrastructure is a good step.

For what I ve been reading, the browser line in grid_configuration.yml do not make any reference of what version of MSIE or Firefox I m running. So I can t get my head around in which form I can tell Grid/RC that I want some specific browsers and the path to run them (how RC knows which exe to run?)

The YAML just lets you know what the grid can handle. When starting up the grid you need to make sure that you pass in similar configurations. Think of Se:GRID like you would Se:RC except you don t care where the RC server is because you speak to a central place that works the rest out for you.

If you need it to run tests against a specific items then you will need to handle this in your test setup. There is a common misconception that all tests will run the same in every single browser. This will happen if you never rely on XPath or CSS selectors in your tests because browsers always handle this slightly differently and the slight differences can lead to flaky tests which should always be avoided.

One way to specify which browser to use for a test is to have a central configuration file. In C# this would be using the app.config that has a collection for each browser and doing

Config

<Firefox>
 <addKey browserVersion= 3.5.6  OS= WindowsXP >
</Firefox>

Central Config Class looking inside 1 element

 public class BoothElement : ConfigurationElement
    {
        [ConfigurationProperty("browserVersion", DefaultValue = "", IsKey = true, IsRequired = true)]
        public string browserVersion
        {
            get
            {
                return ((string)(base["browserVersion"]));
            }
            set
            {
                base["browserVersion"] = value;

            }
        }

Tests

selenium = new DefaultSelenium(HubPort, HubPort, browserVersion, SUTServer);
selenium.Open("/test.htm");
//Rest of the test

In python you could create an Array in a module that you include on all your tests

include.py

hubServer =  hub 
hubPort = 5555
sut =  http://serverUnderTest 
firefox = [hubServer,hubPort,"*chrome",sut]
iexplore = [hubServer,hubPort,"*iehta",sut]

test.py

sel = selenium(firefox)
sel.open("/test.html")
#rest of the test

When using Selenium Grid try thinking of it more as a test infrastructure help framework and hopefully that will help you a little more.

Second, I d like to run portable versions of those browsers. I ve only seen that specified in the tests, and not in the RC s command line to run them. That is the way to do it, per test?

I have never tried to get Selenium to work on mobile browsers and don t think it would work to well, however with Selenium 2 which is currently in alpha there is android support for testing apps.

EDIT FROM COMMENT

   - name:    "Firefox on OS X"
     browser: "*firefox"
   - name:    "Firefox on Linux"
     browser: "*firefox"
   - name:    "IE on Windows"
     browser: "*iehta"
   - name:    "Safari on OS X"
     browser: "*safari"

So say we have the above setup, according to the YAML file we have a number of different *firefox instances. So to call those different ones in our tests our browser setup command would look like

selenium.Start(hubHost, hubPort, "Firefox on Linux", "http://serverUnderTest"); or selenium.Start(hubHost, hubPort, "Firefox on OS X", "http://serverUnderTest");

The hub will translate that into *firefox for you. I prefer having very granular names for my environment instead of the usual *firefox so that if there is a failure its easier to spot where it was and on which specific browser.

Virtual machines can be very handy for setting up "inexpensive" mules in the Selenium Grid farm.





相关问题
Javascript communication with Selenium (RC)

My Application has a lot of calculation being done in JavaScript according to how and when the user acts on the application. The project prints out valuable information (through console calls) as to ...

Running automated Web browser tests under Hudson

I m running Hudson for my automated builds and love it. I d now like to create automated Web browser tests using either WaTiN (preferred) or Selenium. As my Hudson runs as a Windows service (under ...

Using a Java library with Scala reserved words

I m using an external library written in Java (Selenium). One of the function calls has the signature type(String, String), and I keep getting compiler errors when trying to call it from Scala, that ...

Heightened privilege selenium browsers on Windows 7 (x64)

I make use of *firefox and *iexplore etc. within my selenium tests to get around the issue of self-signed SSL certificates on my local machine. Unfortunately, now that I ve moved from XP over to 7, ...

Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Selenium IDE: Incrementing values by 1 and 71

Currently I m incrementing a value called wert by 1 with the following code: getEval storedVars[ wert ]=${wert}+1; The value wert is something like 80401299. I want to add 1 to the value, if it ...

热门标签