Reputation: 1463
I wish to populate a field in my application using execute when running nightwatchjs tests
I have tried the following:
.execute("document.getElementByClassName('.price').setAttribute('value', '19.99')")
This does not work, field is not populated however I do not get an error. Can someone explain what I may be doing wrong?
Thanks!
p.s - I know I can populate the field by using .setValue('.price', '9 .99') but I wish to learn how to do it via execute.
Upvotes: 0
Views: 216
Reputation: 5347
You can try the following code. There is only small changes.
.execute("document.getElementsByClassName('price')[0].setAttribute('value', '19.99')")
Upvotes: 1