Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding an element using placeholder in Protractor?

<input _ngcontent-c6="" formcontrolname="password" 
    name="password" onblur="this.placeholder = 'Password'" 
    onfocus="this.placeholder = ''" 
    placeholder="Password" 
    required="" type="password" 
    ng-reflect-required="" ng-reflect-name="password" 
    class="ng-pristine ng-invalid ng-touched"> 

What is the best way to find an element: placeholder = "Enter Username"?

Scenario: find an element using Snippet above User clicks on the "Enter Name" box, another window pops-up for entering a name.

like image 631
KAILASH M Avatar asked Oct 30 '25 11:10

KAILASH M


1 Answers

For placeholder you can use:

element(by.css('[placeholder = "Password"]'));
like image 87
Anchal Singh Avatar answered Nov 02 '25 23:11

Anchal Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!