//Using Application Model
public void getlistitems() throws GeneralLeanFtException {
Browser browser = BrowserFactory.launch( BrowserType.CHROME);
browser.navigate("http://www.newtours.demoaut.com/");
mtoursapplocal mTours= new mtoursapplocal(browser);
mTours.WelcomePage().REGISTERLink().click();
List< listitem> countries = mTours.RegisterPage().CountryListBox().getItems();
for(ListItem country:countries){
System.out.println(country.getText());
}
}
//Using Descriptive Programming
public void getlistitemsDP() throws GeneralLeanFtException {
BrowserDescription mBrowser = new BrowserDescription.Builder().url("http://www.newtours.demoaut.com/mercuryregister.php").build();
Browser browser = BrowserFactory.attach(mBrowser);
ListBox CountryList = browser.describe(ListBox.class,new ListBoxDescription.Builder().tagName("SELECT").name("country").build());
List< listitem> countries = CountryList.getItems();
for(ListItem country:countries){
System.out.println(country.getText());
}
}
No comments :
Post a Comment