Deleting text in a form field

1,096 views
Skip to first unread message

Roberto Guerra

unread,
Oct 18, 2013, 7:03:57 PM10/18/13
to casp...@googlegroups.com
Hi, First time casperjs user here.

I'm trying to test the following behavior:
1. Enter text in search field and results are updated.
2. Delete text from search field and all the results are shown.

I can do 1, but for 2 I'm stuck. I am trying to delete the text but it is not doing so. I did this.sendKeys('form input[name="query"]', ''); but the input field retains its old value. I noticed that the text is appended to the existing text in the input field.

I would gladly appreciate any suggestions. Thanks.

Nicolas Perriault

unread,
Oct 19, 2013, 8:58:39 AM10/19/13
to casp...@googlegroups.com
Le 19 oct. 2013 à 01:03, Roberto Guerra <uri...@gmail.com> a écrit :

> I can do 1, but for 2 I'm stuck. I am trying to delete the text but it is not doing so. I did this.sendKeys('form input[name="query"]', ''); but the input field retains its old value. I noticed that the text is appended to the existing text in the input field.

I've just added a new `reset` option to sendKeys:
https://github.com/n1k0/casperjs/commit/06646b11cd3a724677061943e042662981699d22

Please update to latest master

++

--
Nicolas Perriault
https://nicolas.perriault.net/
+33 660 92 08 67

Roberto Guerra

unread,
Oct 21, 2013, 9:38:08 AM10/21/13
to casp...@googlegroups.com
Excellent, thanks.

OhSweetTooth

unread,
Apr 7, 2015, 8:27:47 AM4/7/15
to casp...@googlegroups.com
Thank you very much.
Reply all
Reply to author
Forward
0 new messages