2012-10-08 4 views
0

웹 드라이버를 사용하여 셀렌 용 테스트 케이스를 작성하는 데 새로운입니다.셀레늄 : 웹 드라이버로 셀레늄을 설정하는 방법

테스트 케이스를 어떻게 설정할 수 있는지 알려주십시오.

나는 당신이 어떤 그것을 위해 설정이 필요하지 않습니다 파이어 폭스 드라이버와 code.Start에서 브라우저를 구동하기 위해 셀레늄 webdriver을 사용할 수 있습니다 셀레늄 IDE를

감사

답변

1

http://seleniumhq.org/docs/03_webdriver.html#introducing-the-selenium-webdriver-api-by-example

HTH를 : 크롬 등 다른 브라우저를 들어, drivers.You 여기 시작할 수 있습니다 설정할 필요가 즉는 셋업 자신을했을 ... 감사합니다

@RunWith(SpringJUnit4ClassRunner.class) 
@ContextConfiguration(locations = {"classpath:testContextWeb.xml"}) 
public class SeleniumTest { 

WebDriver driver; 

@Before 
public void setUp() throws Exception { 
    driver = new FirefoxDriver(); 
} 

@After 
public void tearDown() throws Exception { 
    driver.close(); 
} 

@Test 
public void testCase() throws Exception { 
    //open the event page 
    driver.get("https://websiteAddress/Context"); 


    driver.findElement(By.xpath(".//*[@id='username']")).sendKeys("someUserName"); 
    driver.findElement(By.xpath(".//*[@id='password']")).sendKeys("xxxx"); // "xxxx" means some password 

} 

} 
1

를 사용하지 않습니다.

+0

감사합니다 그래 ..하지만 난 메인 방법을 testcases을 쓰고 싶지 않아 .. 모든 내가 @Test 주석으로 실행되는 테스트 케이스를 구성하는 방법 . 도와 주셔서 감사합니다 – Bhuvan

관련 문제