0

I have a dropdown menu with dynamic number of options, and I'm trying to chose an option using protractor framework. I see that this issue has been raised several times, but I didn't succeed with any of the proposed solutions.

<select id="VDS_select_customer_on_customer_whitelist_0" name="VDS_select_customer_on_customer_whitelist" 
class="selectpicker show-tick form-control bs-select-hidden" data-width="auto" data-style="btn btn-default btn-sm" 
data-live-search="true" title="Choose Customer...">
    <option class="bs-title-option" value="">Choose Customer...</option>
    <!-- ngRepeat: customer in collection.customers | orderBy:predicate -->
    <option ng-repeat="customer in collection.customers | orderBy:predicate" value="2" class="ng-binding ng-scope">customer0</option>
    <!-- end ngRepeat: customer in collection.customers | orderBy:predicate -->
    <option ng-repeat="customer in collection.customers | orderBy:predicate" value="1" class="ng-binding ng-scope">customer1</option>
    <!-- end ngRepeat: customer in collection.customers | orderBy:predicate -->
</select>
<div class="btn-group bootstrap-select show-tick form-control open" style="width: 196px;">
    <button type="button" class="dropdown-toggle btn btn-default btn-sm" data-toggle="dropdown" data-id="VDS_select_customer_on_customer_whitelist_0" title="Choose Customer...">
        <span class="filter-option pull-left">Choose Customer...</span>
        &nbsp;
        <span class="caret"></span>
    </button>
    <div class="dropdown-menu open" style="min-width: 0px; max-height: 451.011px; overflow: hidden; min-height: 42px;">
        <div class="bs-searchbox">
            <input type="text" class="form-control" autocomplete="off">
        </div>
        <ul class="dropdown-menu inner" role="menu" style="max-height: 399.011px; overflow-y: auto; min-height: 0px;">
            <li data-original-index="1" class="">
                <a tabindex="0" class="ng-binding ng-scope" style="" data-tokens="null">
                    <span class="text">customer0</span>
                    <span class="glyphicon glyphicon-ok check-mark"></span>
                </a>
            </li>
            <li data-original-index="2">
                <a tabindex="0" class="ng-binding ng-scope" style="" data-tokens="null">
                    <span class="text">customer1</span><span class="glyphicon glyphicon-ok check-mark"></span>
                </a>
            </li>
        </ul>
    </div>
</div>

In few examples that I found on the Internet is used by.xpath () method, but it didn't worked for me

    let openCustomers = element(by.xpath('//*[@id="customerWhitelistDetail"]/div[2]/div[1]/div/button'));
    openCustomers.waitReady();
    openCustomers.click();

    let customer = element(by.xpath('//*[@id="customerWhitelistDetail"]/div[2]/div[1]/div/div/ul/li[1]/a'));
    customer.waitReady();
    customer.click();
3
  • what error do you get Commented Sep 6, 2020 at 22:03
  • I don't get any errors, just nothing happens when I call these methods. Commented Sep 7, 2020 at 7:15
  • i'd start with javascript click. Look up how to do it in protractor Commented Sep 8, 2020 at 12:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.