This is a migrated thread and some comments may be shown as answers.

Extract selected text from kendo combo box

3 Answers 81 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shea
Top achievements
Rank 1
Shea asked on 24 Oct 2014, 08:17 PM
I am trying to extract the contents of a combo box, but the only way TS wants to do it is using a absolute method, like tag index, or xpath, or htmlpath. This means that if a designer moves that combo on the page at all my test is broken.

The element which contains the actual text is generated by kendo, and thus I can't code a tag to it to make the test easier. However there is a surrounding take that has a good tag on it (aria-owns="ContactID_listbox"). If I could use a relative index to that item, I may be ok, as the relative index isn't like to change unless kendo's rendering changes.  But I can't seem to find a way to do that.

I realise Test Studio is really meant for Internet Explorer, and the 'kendo' features don't work with Chrome. But we have had to abandon IE due to it's lack of WebSQL support. So if there is a better way to record this extraction that works in Chrome, please suggest.

Thanks,
~Shea M.

3 Answers, 1 is accepted

Sort by
0
Shea
Top achievements
Rank 1
answered on 24 Oct 2014, 08:21 PM
I forgot to post the html snippet:
01.<tr>
02.   <td class="contact-hd">
03.      <label for="ContactID" class="contact-lbl">On-Site Contact:</label>
04.   </td>
05.   <td class="contact-input" colspan="3">
06.      <span class="k-widget k-dropdown k-header ng-pristine ng-valid" unselectable="on" role="listbox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-owns="ContactID_listbox" aria-disabled="false" aria-readonly="false" aria-busy="false" aria-activedescendant="ContactID_option_selected" style="width: 328px;">
07.         <span unselectable="on" class="k-dropdown-wrap k-state-default"><span unselectable="on" class="k-input ng-scope">Mark Hammil (555-555-5864)</span><span unselectable="on" class="k-select"><span unselectable="on" class="k-icon k-i-arrow-s">select</span></span></span>
08.         <select id="ContactID" name="Contacts" style="width: 328px; display: none;" data-k-placeholder="'-- Select a Contact --'" data-k-data-text-field="'FullNamePhone'" data-k-data-value-field="'ContactId'" data-k-data-source="contactNames" data-ng-model="ticket.ContactId" class="ng-valid ng-pristine" data-role="dropdownlist">
09.            <option value="18">Jerry Block</option>
10.            <option value="30" selected="selected">Mark Hammil (555-555-5864)</option>
11.            <option value="167">Greg Hornshaw</option>
12.            <option value="211">Bruce Nociar</option>
13.         </select>
14.      </span>
15.   </td>
16.</tr>


0
Shea
Top achievements
Rank 1
answered on 24 Oct 2014, 08:29 PM
Hmm, the following seems to work.  Let me know if there is a better way.
0
Boyan Boev
Telerik team
answered on 29 Oct 2014, 12:23 PM
Hello Shea,

This seems reliable.

If the span will be always the second element within the span with aria-owns:ContactID_listbox, the find expression will be stable.

If you need further help, please let us know.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Shea
Top achievements
Rank 1
Answers by
Shea
Top achievements
Rank 1
Boyan Boev
Telerik team
Share this question
or