Problema startar browser e aplicação usando Selenium Remote Control (RC)

1 resposta
cristianonasciment

Prezados, estou querendo aprender mais sobre selenium e fiz um método em Junit que usa o selenium server para automatizar o teste.
Estou usando o internet explorer, pois nos meus testes usando o firefox só funcionou até a versão 12.

public class CasoTesteLogin extends TestCase implements ConstantesTestlink{
	
	final String SERVER_HOST = "localhost";
	final Integer SERVER_PORT = 4444;
	final String BROWSER_COMMAND = "*iexplore C:\\Arquivos de programas\\Internet Explorer\\iexplore.exe";
	//final String BROWSER_COMMAND = "*firefox C:\\Arquivos de programas\\Mozilla Firefox\\firefox.exe";
	final String BROWSER_URL = "http://odindesenv:8080/odin-idp/";
	
	Selenium selenium;
	SeleniumServer server;
	
	// método do JUnit para configurar o teste automatizado
	public void setUp() throws Exception{
		selenium = new DefaultSelenium(SERVER_HOST, SERVER_PORT, BROWSER_COMMAND, BROWSER_URL);
		server = new SeleniumServer();
		
		server.start();
		selenium.start();
		
	}
	
	// método do JUnit para destruir o teste automatizado
	public void tearDown() throws Exception {
		selenium.stop();
		server.stop();
	}
	
	@Test //caso de teste automatizado
	public void testLogin() throws Exception{
		
		String resultadoTeste = null;
		String nota = null;
		
		try {
			selenium.open("/");
			
			selenium.type("j_username", "10191");
			selenium.type("j_password", "teste123");
			
			selenium.click("form_entrar");
			selenium.waitForPageToLoad("30000");  
			
			resultadoTeste = TestLinkAPIResults.TEST_PASSED;
		} catch (Exception e) {
			resultadoTeste = TestLinkAPIResults.TEST_FAILED;
			nota = e.getMessage();
			e.printStackTrace();
			
		} finally {
			ResultadoExecucao.reportTestCaseResult(PROJETO_TESTE, PLANO_TESTE, CASO_TESTE, BUILD, nota, resultadoTeste);
		}
	}

}

quando eu executo o teste

11:34:11.244 INFO - Java: Sun Microsystems Inc. 17.1-b03
11:34:11.244 INFO - OS: Windows XP 5.1 x86
11:34:11.244 INFO - v2.0 [a2], with Core v2.0 [a2]
11:34:11.337 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
11:34:11.337 INFO - Version Jetty/5.1.x
11:34:11.337 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:34:11.337 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:34:11.337 INFO - Started HttpContext[/,/]
11:34:11.400 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@90cb03
11:34:11.400 INFO - Started HttpContext[/wd,/wd]
11:34:11.400 INFO - Started SocketListener on 0.0.0.0:4444
11:34:11.400 INFO - Started org.openqa.jetty.jetty.Server@12d3205
11:34:11.447 INFO - Checking Resource aliases
11:34:11.447 INFO - Command request: getNewBrowserSession[*iexplore C:\Arquivos de programas\Internet Explorer\iexplore.exe, http://odindesenv:8080/odin-idp/, ] on session null
11:34:11.447 INFO - creating new remote session
11:34:11.462 INFO - Allocated session bc95314502f24e53ada0de16f666370e for http://odindesenv:8080/odin-idp/, launching...
11:34:11.728 INFO - Launching Embedded Internet Explorer...
11:34:12.806 INFO - Launching Internet Explorer HTA...

ele abre o browser mas não acessa a URL que eu mensionei. abre o browser com a URL em branco. alguém sabe o porque ?

Agradeço desde já,

1 Resposta

cristianonasciment

estou seguindo esse exemplo:

http://www.blogger.com/comment.g?blogID=3461000873164784806&postID=754088504090687279

Criado 7 de janeiro de 2013
Ultima resposta 7 de jan. de 2013
Respostas 1
Participantes 1