Protractor testing: How to set the value of text elements in a login form?

后端 未结 6 688
清酒与你
清酒与你 2020-12-15 02:42

I am writing tests in Protractor for an Angular app. I want to fill out a login form and submit it.

How can I do this? I have got this far, but I don\'t know how to

6条回答
  •  无人及你
    2020-12-15 03:08

    As per above answers , you can use sendkeys in most cases . If didn't work only you can inject the text to the element using a java script .

     var locatorid='datepicker1';
              var val= '12/31/2019';
              //without parameterized
              browser.executeScript("document.getElementById('datepicker1').value= '10/21/2019'");
             //After parameterized
              browser.executeScript("document.getElementById('"+locatorid+"').value= '"+val+"'");
               browser.sleep(3000);
    

提交回复
热议问题