Facebook

Course Name Start Date Time Duration Registration Link
No Training Programs Scheduled ClickHere to Contact
Please mail To sudhakar@qtpsudhakar.com to Register for any training

Tuesday, February 2, 2016

Get Items From a Listbox using LeanFT Java

//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