Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
Course Name Date Time Duration Type Location
WhatsApp to 91-8328152362 for address details of AnyTechLabs
Selenium + Appium 27th February 2019 7.00 AM IST to 8:45 AM IST 45 Days Class Room + Online AnyTechLabs
Selenium + Appium 9th March 2019 9.00 AM IST to 2.00 PM IST 5 WeekEnds Class Room + Online AnyTechLabs

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

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