javascript - How to click on drop down with on-toggle property -


  <div ng-if="domainlist.length>1" class="form-group ng-scope">             <div class="col-sm-3">                 <label translate="zillamain.authentication" class="ng-scope">authentication</label>             </div>             <div class="col-sm-9">                 <label uib-dropdown="" keyboard-nav="true" on-toggle="toggled(open)" class="dropdown">                     <a href="" tabindex="0" aria-label="" uib-dropdown-toggle="" class="dropdown-toggle" aria-haspopup="true" aria-expanded="false">                         <!-- ngif: authentication_domain -->                         <!-- ngif: !authentication_domain --><h3 ng-if="!authentication_domain" class="ng-scope">                             <span translate="zillamain.select" class="ng-scope">select</span>                             <i class="icon angle-down-icon"></i>                         </h3><!-- end ngif: !authentication_domain -->                     </a>   ------   ------   ------ 

with above mentioned code trying clcik on dropdown:

this.authdd = element(by.css('[on-toggle="toggled(open)"]'));  authdd.click(); 

but not click on drop down , test not fail also... not sure wrong it.

i have tried changing locator by: element(by.css('a.dropdown-toggle')); or element(by.css('[translate="zillamain.select"]')); not clcik on dropdown.

is there different way available in protractor click on dropdown ?

i'd improve way targeting dropdown (i think locator broad in general - might not broad in context of page, don't have work with) , point locator a element enforcing reliability appropriate wait condition:

var authdropdown = element(by.xpath("//label[. = 'authentication']/following::label[@class = 'dropdown']/a")); var ec = protractor.expectedconditions;  browser.wait(ec.elementtobeclickable(authdropdown), 5000); authdropdown.click(); 

we using kind of xpath expression because want target not dropdown toggle link, 1 coming after "authentication" label.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -