I am working on selenium webdriver, and I came up with a certain scenario. There is a drop down list, and user selects one of the values (Text). The selected value (text) is now displayed on the drop down field.
I want to know how can I extract the text out of that element (div) and then assert it with the selected value (text).
The HTML of the element is:
<div class="kac-entry kac-select kac-display ng-binding" ng-click="toggleDropdown()" ng-hide="shouldShowPlaceholder()" ng-class="{btn: btnStyle, 'btn-primary': btnStyle}" style=""> ^NYA (NYSE COMPOSITE INDEX (NEW METHOD)) </div>
The xpath of the above element is:
//price-trigger[@class='ng-isolate-scope']/div/div[2]/div[1]/div[1]/k-select/div/div[1]
The text in the HTML element is ^NYA (NYSE COMPOSITE INDEX (NEW METHOD)). I want to get this title and check if this is the option (value) that user actually selected or not.
Any help will be highly appreciated.