1 19 20 package org.apache.geronimo.testsupport; 21 22 import com.thoughtworks.selenium.Selenium; 23 24 import org.openqa.selenium.server.SeleniumServer; 25 26 import org.testng.annotations.BeforeSuite; 27 import org.testng.annotations.AfterSuite; 28 29 34 public class SeleniumTestSupport 35 extends TestSupport 36 { 37 protected static ExtendedSelenium selenium; 38 39 protected ExtendedSelenium createSeleniumClient(String url) throws Exception { 40 super.setUp(); 41 42 if (url == null) { 43 url = "http://localhost:" + SeleniumServer.DEFAULT_PORT; 44 } 45 46 log.info("Creating Selenium client for URL: " + url); 47 48 ExtendedSelenium selenium = new ExtendedSelenium( 49 "localhost", SeleniumServer.DEFAULT_PORT, "*firefox", url); 50 51 return selenium; 52 } 53 54 @BeforeSuite 55 protected void startSeleniumClient() throws Exception { 56 log.info("Starting Selenium client"); 57 58 selenium = createSeleniumClient("http://localhost:8080/"); 59 selenium.start(); 60 } 61 62 @AfterSuite 63 protected void stopSeleniumClient() throws Exception { 64 log.info("Stopping Selenium client"); 65 66 selenium.stop(); 67 } 68 69 79 80 89 } 90 91 | Popular Tags |