I was creating a script in Java and wanted to run the script using TestNG and Eclipse. I was getting the following error when running the script.
The constructor DefaultSelenium(String, String, String, String) is undefined
To solve the issue you will have to make change to the setUp method.
My code was something like this selenium = new DefaultSelenium(“localhost”, “4444″, “*iexplore”, “http://www.google.com/”); having 4444 as a string. I then changed the code to selenium = new DefaultSelenium(“localhost”, 4444, “*iexplore”, “http://www.google.com/”);

try these changes in setup methond:
import org.openqa.selenium.server.SeleniumServer;
public void setUp() throws Exception {
SeleniumServer seleniumserver=new SeleniumServer();
seleniumserver.boot();
seleniumserver.start();
setUp(“http://www.google.com/”, “*iexplore”);
selenium.open(“/”);
selenium.windowMaximize();
selenium.windowFocus();
}
Hey Rishi, thanks a lot for the setup method.
package test;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class Test {
public static void main(String[] args) throws MalformedURLException {
System.out.println(“Hello World!”);
Selenium selenium = new DefaultSelenium(“localhost”,4444,”C:\\Program Files (x86)\\Mozilla Firefox.exe”,”http://www.google.com”);
DesiredCapabilities capability = DesiredCapabilities.firefox();
WebDriver driver = new RemoteWebDriver(new URL(“http://localhost:4444/wd/hub”), capability);
capability.setBrowserName(“firefox”);
capability.setVersion(“9.0.1″);
}
}