Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
New Schedule in MindQ Systems, Madhapur By SUDHAKAR
Course Name Date Time Duration Type Branch
UFT + UFTPro 20th September 2017 7.30 AM - 9.00 AM IST 25Days Classroom + Online Hitech City
Selenium+Appium 4th October 2017 4.30 PM - 6.00 PM IST 40Days Online -

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