java.lang.RuntimeException: Could not contact Selenium Server; have you started it on 'localhost:4444' ?
Read more at http://seleniumhq.org/projects/remote-control/not-started.html
Connection refused: connect
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:86)
at br.edu.junitlearning.seleniumtests.TesteSelenium.main(TesteSelenium.java:23)
Código:
[code]package br.edu.junitlearning.seleniumtests;
import com.thoughtworks.selenium.CommandProcessor;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.HttpCommandProcessor;
public class TesteSelenium {
public static void main(String[] args) {
try {
int port = 4444;
String host = "localhost";
String browser = "*firefox";
String baseUrl = "http://www.google.com";
CommandProcessor command = new HttpCommandProcessor(host, port, browser, baseUrl);
DefaultSelenium selenium = new DefaultSelenium(command);
System.out.println(host + port + browser + baseUrl);
selenium.start();
selenium.open("http://www.google.com/webhp");
selenium.waitForPageToLoad("9000");
selenium.type("q", "java na cabeça abril blogs");
selenium.click("btnG");
selenium.waitForPageToLoad("9000");
selenium.click("//div[@id='res']/div/ol/li[1]/h3/a/em[2]");
selenium.waitForPageToLoad("9000");
System.out.println(selenium.isTextPresent("teste"));
} catch (Exception e) {
e.printStackTrace();
}
}
}[/code]
Alguém pode ajudar?