Re: Deploying Selenium IDE exports (JUnit 4 [Webdriver]) to Selenium Grid for parallel tests

Posted by softwaretestingforum on
URL: http://manual-and-automated-testing.232.s1.nabble.com/Deploying-Selenium-IDE-exports-JUnit-4-Webdriver-to-Selenium-Grid-for-parallel-tests-tp4932235p4945368.html

Don't feel dim, ask whatever you face problem with :)

It is referring to place where you instantiate selenium object. But having a look at your gist it looks like you are not instantiating it, which is why you encounter null pointer exception . Hence use it as -

@Test public void O13RegStaging() throws Exception {
                Selenium selenium = new DefaultSelenium(“localhost”, 4444, “*firefox”, “http://www.google.com”);
                selenium.open("your URL here");
                selenium.click("id=play_now_glow");
                selenium.waitForPageToLoad("30000");
                selenium.click("css=img.sweety_button");
                selenium.type("id=user_user_profile_attributes_first_name", "QA");
                selenium.type("id=user_use
..
.
.
.


Or better, you can move selenium object instantiation to a common class and annotate it with @Before (if you are on Junit) like -

public class SelTestCase {

     protected Selenium selenium;

    @Before
     public void setup() {
      Selenium selenium = new DefaultSelenium(“localhost”, 4444, “*firefox”, “http://www.google.com”);
      selenium.start();
     }

   @After
     public void setup() {
      selenium.close();
     }
}


Now you test class can extend it and you get the selenium object -

public class NewO13STAGING extends SelTestCase {
        @Test public void O13RegStaging() throws Exception {
                selenium.open("/");
                selenium.click("id=play_now_glow");
                selenium.waitForPageToLoad("30000");
..
..
.
}

 

Remember in line -

new DefaultSelenium(“localhost”, 4444, “*firefox”, “http://www.google.com”);

localhost and 4444 should refer to your hub host and port
~ seleniumtests.com