I am new to selenium and I am finding difficulty in getting option from dropdown also how to take className if the class has space in between,please help me,thanks in advance.
I used select with selectbyindex also partialvisibletext but nothing worked.
This is the HTML code
<div class="form-group" xpath="1">
<label>Source of Info</label>
<!-- <select class="form-control flat-control-inner" ng-model="userPersonal.sourceOfInfo.id" required>
<option ng-value="0">--Select--</option>
<option data-ng-repeat="si in sourceOfInfoList" data-ng-value="{{si.id}}" ng-selected="si.id==userPersonal.sourceOfInfo.id">{{si.name}}</option>
</select> -->
<select class="form-control flat-control-inner dateonly ng-valid ng-touched ng-empty ng-dirty ng-valid-parse" ng-model="userPersonal.sourceOfInfo.id" ng-options="si.id as si.name for si in sourceOfInfoList" style="">
<option value="" class="">--Select--</option>
<option label="Newspaper" value="number:1">Newspaper</option>
<option label="Facebook" value="number:2" selected="selected">Facebook</option>
<option label="Twitter" value="number:3">Twitter</option>
<option label="Television" value="number:4">Television</option>
<option label="Others" value="number:5">Others</option>
</select>
</div>
This is what I tried
WebElement source_dropdown = driver.findElement(By.xpath("//select[@class='form-control flat-control-inner dateonly ng-valid ng-touched ng-empty ng-dirty ng-valid-parse']"));
Select source = new Select(source_dropdown);
source.selectByIndex(1);
This what I am getting in console
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//select[@class='form-control flat-control-inner dateonly ng-valid ng-touched ng-empty ng-dirty ng-valid-parse']"}