티스토리 뷰
http://www.seleniumhq.org/docs/07_selenium_grid.jsp
위사이트에서
selenium-server-standalone-2.44.0.jar
를 다운받는다.
grid 서버를 실행 시킨다.
-grid server
java -jar selenium-server-standalone-2.44.0.jar -port 4444 -role hub -nodeTimeout 600
포트는 4444로 선정하였다.
http://localhost:4444 사이트로 접근하면 grid 서버가 실행 된거
확인 할수 있다.
리모트 서버를 아래 명령어로 실행 시킨다.
포트는 5555로 하고 grid 서버는 localhost로 지정하였다.
-rc server
인터넷익스프롤러 경우
java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register -maxSession 20 -port 5555 -Dwebdriver.ie.driver=c:\selenium_ex\IEDriverServer.exe
구동시 참고 코드
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.naver.com/");
크롬일 경우
java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register -maxSession 20 -port 5555 -Dwebdriver.chrome.driver=c:\selenium_ex\chromedriver.exe
구동시 참고 코드
selenium = new DefaultSelenium("localhost", 5555, "*googlechrome", "http://www.naver.com/");
파이어폭스일 경우
java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register -maxSession 20 -port 5555 -Dwebdriver.firefox.driver="C:\\Program Files\\Mozilla Firefox\\firefox.exe"
구동시 참고 코드
selenium = new DefaultSelenium("localhost", 5555, "*firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe", "http://www.naver.com/");
<테스트 예제 전체 코드>
예제 생성 방법은
firefox IDE 에서 Test 예제 레코딩 이후
Export Test Case As... -> Java / Junit4 / Remote Control
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.regex.Pattern;
public class Tests {
private Selenium selenium;
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 5555, "*firefox C:\\Program Files\\Mozilla Firefox\\firefox.exe", "http://www.naver.com/");
selenium.start();
}
@Test
public void testS() throws Exception {
selenium.open("/");
selenium.click("id=query");
selenium.type("id=query", "test");
selenium.click("id=search_btn");
selenium.waitForPageToLoad("30000");
}
@After
public void tearDown() throws Exception {
//selenium.stop();
}
}
참고 사이트 : http://www.youtube.com/watch?v=9b5lGfBKzj0
http://stackoverflow.com/questions/10007658/selenium-grid-does-not-run-chrome-on-another-computer
http://stackoverflow.com/questions/5282476/when-i-run-the-selenium-rc-script-i-am-getting-failed-to-start-new-browser-fir
'program' 카테고리의 다른 글
url-shortener (0) | 2015.04.15 |
---|---|
native app을 테스트하기위한 selenium (0) | 2015.01.13 |
Continuous Integration - Hudson (0) | 2015.01.12 |
Continuous Integration by Martin Fowler 1/15 (0) | 2015.01.11 |
CI Server Matrix (0) | 2015.01.11 |