This is Dropdown can you please tell me how to select 2nd or 3rd option from the dropdown in selenium webdriver. Mr is default selected -
i not able select dropdown value. can please me out.
<div id="sbholder_43830942" class="sbholder" tabindex="1"> <a id="sbtoggle_43830942" class="sbtoggle" href="#"/> <a id="sbselector_43830942" class="sbselector" href="#">mr.</a> <ul id="sboptions_43830942" class="sboptions" style="top: 24px; max-height: 100px; display: none;"> <li><a class="" href="#mr" rel="mr">mr.</a> </li>` <li><a class="" href="#ms" rel="ms">ms.</a></li> <li><a class="" href="#mrs" rel="mrs">mrs.</a></li> <li><a class="" href="#mx" rel="mx">mx.</a></li> </ul> </div>
//clicks on drop down box driver.findelement(by.xpath("//a[@class='sbselector']")).click(); //select options drop down box based on rel attribute driver.findelement(by.xpath("//ul[@class='sboptions']/li/a[@rel='ms']")).click();
change rel attribute mrs,mx select respective option per requirement
i checked above code worked fine
hope helps you...kindly if have queries
Comments
Post a Comment