How to use Selenium Grid???
        Posted  
        
            by user300591
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user300591
        
        
        
        Published on 2010-03-24T07:30:03Z
        Indexed on 
            2010/03/24
            7:33 UTC
        
        
        Read the original article
        Hit count: 537
        
Hi All,
I'm researching Selenium and have a seminar for my group... I meet many troubles with this I use C# language and write a demo SeleniumExample.dll Then i start selenium RC and NUnit and run it with nUnit to see the test report. I read testdata from xml.
Here's the SeleniumExample.dll: using System;
using System.Xml; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using Selenium;
namespace SeleniumExample {
public class Success_Login {
  //User defined
   private string strURL = "http://newtours.demoaut.com/
mercurywelcome.php"; private string[] strBrowser = new string[3] { "*iehta", "*firefox", "*safari" };
   // System defined
   private ISelenium selenium;
           private StringBuilder verificationErrors ;
           [SetUp]
           public void SetupTest()
           {
                   selenium = new DefaultSelenium("localhost", 4444,
this.strBrowser[0], this.strURL); selenium.Start(); verificationErrors = new StringBuilder(); }
           [TearDown]
           public void TeardownTest()
           {
                   try
                   {
                           selenium.Stop();
                   }
                   catch (Exception)
                   {
                           // Ignore errors if unable to close the browser
                   }
                   Assert.AreEqual("", verificationErrors.ToString());
           }
           [Test]
   public void Success_LoginTest()
           {
       try
       {
           XmlDocument doc = new XmlDocument();
           XmlNode docNode;
           doc.Load("XMLFile1.xml");
           docNode = doc["TestCase"];
           foreach (XmlNode node in docNode)
           {
               selenium.Open("/");
               selenium.Type("userName",
node["username"].InnerText); selenium.Type("password", node["password"].InnerText); selenium.Click("login"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Find a Flight: Mercury Tours:", selenium.GetTitle()); } } catch (AssertionException e) { verificationErrors.Append(e.Message); } } } }
Now I wan to have a demo that using Selenium Grid (SG) but i dont know how to do. I read document and understand the way SG works. I install SG and install Ant1.8. The tests will communicate with Selenium Hub. Actually, I just understand the theory i dont know how to make the tests communicate with Selenium Hub and how to make Selenium Hub control Selenium RC.
I am a new for Selenium. If anyone know this, please help me. I appreciate it so much.
THANKS, Hoang
© Stack Overflow or respective owner