java - Dropdown selection in selenium -
below html code:
<div class="dropdown-datepicker ng-scope" ng-class="{invalid : !o[typeofdate].valid && formdata[typeofdate], valid : o[typeofdate].valid}" label-since-month="seit monat" label-since-year="seit jahr" month-placeholder="monat" year-placeholder="jahr" label-datepicker=" seit" date="employedsince" tooltip="bitte geben sie hier den monat und das jahr an, seit dem sie in dem unternehmen beschäftigt sind" set-tabindex="0" r-dropdown-datepicker=""> <p class="dropdown-date-label bold italic ng-binding"> seit</p> <div class="custom-select white month"> <span class="chevron-thin-down">-</span> <select class="special-valid ng-pristine ng-valid ng-scope ng-touched" ng-blur="isslidevalid(slider.index)" ng-model="o[typeofdate].month" name="years" tabindex="0"> <option class="ng-binding" style="display: none;" selected="" disabled="" value="">monat</option> <option class="ng-binding ng-scope" ng-selected="o[typeofdate].month == $index+1" value="1" ng-repeat="m in monthsdrop">januar</option> </select> <div class="custom-select white year"> <select class="special-valid ng-pristine ng-untouched ng-valid ng-scope" ng-blur="isslidevalid(slider.index)" ng-model="o[typeofdate].year" name="years" tabindex="0"> <option class="ng-binding" style="display: none;" selected="" disabled="" value="">jahr</option> <option class="ng-binding ng-scope" ng-selected="o[typeofdate].year == y" value="2015" ng-repeat="y in yearsdrop">2015</option> <option class="ng-binding ng-scope" ng-selected="o[typeofdate].year == y" value="2014" ng-repeat="y in yearsdrop">2014</option> </select> </div> </div>
i facing issues drop down selections.i've tried following it's not working
new select(driver.findelement(by.xpath("(//select[@name='years'])[3]"))).selectbyvisibletext("mai");
please me
try this:
webelement webelement = driver .findelement(by .xpath("//select[@class='special-valid ng-pristine ng-valid ng-scope ng-touched']")); select select = new select(webelement); select.selectbyvisibletext("monat");
you can use ,
select.selectbyindex(1);
instead of
select.selectbyvisibletext();
Comments
Post a Comment