3
votes

I need help on creating a protractor typescript code, how do i click this button? it has _ngcontent and span buttontext, does anyone have an idea how to do this? code on the site is:

 <span _ngcontent-c6  class="braeting net-subheading-2"> ... </span>
 <button _ngcontent-c6  class="tulbar-button net-button" net-button>
   <span class="net-button-wrapper">
      <span _ngcontent-c6="">Login</span>
   </span>
  <div class="net-button-ripple net-ripple" matripple></div>
 <div class="net-button-focus-overlay"></div>
 </button>

i've tried the following below, i can't seem to make it work..

clickSignin = element(by.cssContainingText('tulbar-button net-button','Login'));
clickSignin = element(by.xpath('//span[@class="tulbar-button net-button"][_ngcontent-c6="Login"]'));
clickSignin = element(by.xpath('//span[@class="tulbar-button net-button"][text()="Login"]'));

then performed

clickSignin.click();

none of them seem to work.. and error says: Failed: No element found using locator: By(xpath..... or by.cssContainingText....

1

1 Answers

1
votes

Try this:

note: your argument for cssContainingText is wrong

clickSignin = element(by.cssContainingText('.tulbar-button.net-button','Login'));