Srinivas
Srinivas

Reputation: 3

Selecting an option in drop down menu using Selenium

Can someone help me in selecting option Inquiry from below code? I have tried but failed.


<div class="SplitButton" id="HIRA_SPLITBUTTON" splitBtnName="pyDescription" btnType = "menu" onSplMenuClick='HIRA.ui.gadget.NewWork.StartProcess4Menu'>
    <select id="pyDescription">
        <option value='className&#61;HIRAFS-Work-Inquiry&amp;flowType&#61;Inquiry&amp;HarnessVersion&#61;1'> Inquiry </option>
        <option value='className&#61;HIRAFS-Work-Copy&amp;flowType&#61;Copy&amp;HarnessVersion&#61;1'> Copy </option>
    </select>
    <table class='buttonMainTable' border='0' cellspacing='0' cellpadding='0' id='' >
        <tr>
            <td class='buttonTdLeft'>
            <div class="buttonLeftContent">
                <div class="buttonLeftContentInner">
                    &nbsp;
                </div>
            </div></td><td class='buttonTdMiddle'>
            <button class='buttonTdButton' alt='' title='' HIRA_VERSION='HTMLPROPERTY' id='HIRA_SPLITBTNpyDescription'>
                <table cellspacing='0' cellpadding='0'>
                    <tr>
                        <td valign='top'><img src='desktopimages/new.gif' style='margin-top:-1px'/></td><td valign='middle' style='white-space:nowrap;'>New</td>
                    </tr>
                </table></span>
            </button></td><td class='buttonTdRight'>
            <div class="buttonRightContent">
                <div class="buttonRightContentInner">
                    &nbsp;
                </div>
            </div></td>
        </tr>
    </table>
</div>

Upvotes: 0

Views: 1166

Answers (1)

CBRRacer
CBRRacer

Reputation: 4659

You need to have to reference the webdriver support dll to do the following.

SelectElement select = new SelectElement(element);
select.SelectByText("Inquiry");

If you are using Visual Studios with NuGet then you can go to your powershell and type

Install-Package Selenium.Support

and that will install all of the references and dlls that you need.

Upvotes: 1

Related Questions