Search code examples
javascriptjqueryui-automationui-testingnightwatch.js

How to set value into textarea attribute using nightwatch.js


I am working on nighwatch.js for web ui testing, I want to set value to a textarea, and textarea has an attribute which has my actual text, I am writing full textarea and how I am setting in following.

<div class="textarea-description">
    <textarea cols="50" class="myClass setText" data-def placeholder="text to be replaced using nightwatch"/>
</div>

I am trying to set value in above textarea's attribute data-def placeholder as following ways

browser.setValue('.textarea-description textarea[type=text]','nightwatch'); or
browser.setValue('.textarea-description textarea[data-def placeholder=text]','nightwatch'); or
browser.setValue('.textarea-description textarea[type=data-def placeholder]','nightwatch');

but nothing is working.


Solution

  • Thank you for your all valuable suggestions, all suggestions provided by you was able to give good knowledge but unfortunately none of the suggestion worked. I have resolved it by using following.

    client.setValue('.textarea-description textarea','new text to be write.');
    

    Actually attribute "data-def placeholder" was using only watermark that was not actual text, so it is working.