Mobile QA Zone

A Mobile Application Testing Community

What are the different ways to select value using Webdriver's Select class ?

Views: 43

Reply to This

Replies to This Discussion


Most of the top software testing companies follow the below mentioned approach to select an option from a drop down using selenium webdriver:

Setep 1:  Import the package org.openqa.selenium.support.ui.Select

Step 2: Identify the locator of the drop-down and declare the drop-down element:
Select dropDownName= new Select(driver.findelement(By.<locator>)));

Step 3: Now there are two ways for selecting an option:
  a. Selecting option by text:
     dropDownName.selectByVisibleText("<dropdown option>")

  b. Selection option by index value
      dropDownName.selectByIndex(1);

RSS

© 2018   Created by Anurag Khode.   Powered by

Badges  |  Report an Issue  |  Terms of Service

Welcome to Mobile QA Zone, a Next Generation Software Testing Community.Invite your friends to join this community.Write to us to become a featured member.