I have the below HTML for an element on the page. It is of type combobox-view and list is dynamic
<div id="sender-combobox" class="sc-view scui-combobox-view sc-regular-size" style="left: 0px; right: 0px; top: 26px; height: 24px">
<div id="sc14188" class="sc-view sc-button-view icon square sc-regular-size" style="right: 0px; width: 28px; top: 0px; height: 24px" role="button" alt="" title="">
<span class="sc-button-inner" style="min-width:80px">
<label class="sc-button-label ellipsis">
<img class="caret" alt="" src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==">
</label>
</span>
</div>
<label id="sc14190" class="sc-view sc-text-field-view oldWebKitFieldPadding sc-hint sc-regular-size" style="left: 0px; right: 28px; top: 0px; height: 22px">
<span class="border"></span>
<span class="padding">
<input class="field" type="text" maxlength="5096" spellcheck="false" placeholder="Set Default Username" value="Set Default Username" name="sc14190">
</span>
</label>
</div>
Now i am trying to select an item from combo box by declaring the element as select_list and using Select method from (http://www.rubydoc.info/github/cheezy/page-object/PageObject/Platforms/SeleniumWebDriver/SelectList#select-instance_method).
select_list(:default_sender, {xpath: "//div[@id='sender-combobox']/div/span/label/img"})
default_sender_element.Select('User1')
I get an error that there is no Select method. I am unable to figure out the reason: is it because of element type not being a combo box and hence Select method is not working?
fyi..I included 'selenium-webdriver'in my file.
As another approach, i declared the combox as two different items (Search box + button) and tried to enter text by using send_keys(value), search will give the result. But i am not able to click the result.
I am stuck at this point. Any help or direction is appreciated.
The sample code you provided does not have any
selectelements, so you cannot access them withselect_list. Which is exactly what the error is telling you.No it is not, as there is no such type defined in the HTML standard!
You will need to access everything with clicks. The page is probably going to be dynamically built, so you will have to refresh your locators after every click. Have a look at this post for a very similar problem.