나는 오래 전에 webdriver를 사용하기 시작했습니다. 다음과 같이 나의 접근 방식은 다음과 같습니다webderiver에 대한 나의 접근 방식
public class PageObjectRepresentationClass {
protected WebDriver driver;
public PageObjectRepresentationClass(WebDriver driver){
this.driver = driver;
}
public void open(String url){
driver.get(url);
}
public void close(){
driver.quit();
}
public void fillInputFieldByXPath(String xpath, String value){
WebElement inputField = driver.findElement(By.xpath(xpath));
inputField.clear();
inputField.sendKeys(value);
}
public PageObjectRepresentationClass clickButtonByClassXPath(String xpath){
driver.findElement(By.xpath(xpath)).click();
return new PageObjectRepresentationClass(driver);
}
...
// Basically I make here every possible method that deals with my pages
}
이제 내 JUnit 테스트에 내가 가진 :
webdriver를 사용하여 나의 접근 방식이다public class CreateCompanyGermany {
@Before
public void pagefactory() {
page = PageFactory.initElements(new InternetExplorerDriver(), PageObjectRepresentationClass.class);
page.open(url);
}
@After
public void closeBrowser(){
page.close();
}
@Test
public void internetApplying(){
page.open(url);
page.chooseOptionFromDropDownMenuById("String", "String");
page.fillInputFieldByName("String", "String");
page.fillInputFieldByName("String", "String");
page.chooseOptionFromDropDownMenuById("String", "String");
// So from here on I'm just calling methods defined in PageObjectRepresentationClass
}
. 이제 내가 알고 싶은 것은 Selenium 1과 비교할 때 어디에서 이익을 얻을 것인가? 내 방법은 다음 것만 selenium2/webdriver에서 Selenium1을 다른 것은 webdriver의 한 페이지를 처리하기위한 유일한 방법을, 그래서 대신 내가
있을 것이다 지금selenium.someMethod(); // derives from selenium API
를 작성 할 수 있다는 사실은, 맞다면 내 말은
page.myMethod(); // in this particular case derives from PageObjectRepresentationClass
코드 관련 사항을 유지하는 한 어떤 이점도 보이지 않거나 잘못하고 있습니까? 미리 감사드립니다.