alwex / php-casperjs

simple PHP wrapper for CasperJS
MIT License
182 stars 71 forks source link

Fill fields with no form #50

Open fahadacheema opened 6 years ago

fahadacheema commented 6 years ago

I want to fill input fields on a website but the problem is I cannot use the FillForm funtionality as they are not in a form. There is also a submit button which is not connected to any form but is managed through javascript. In short I want to fill some fields anc click that button. How can I do that?

milicevic79 commented 6 years ago

I used sendKeys() method for that. So, for instance, $casper->sendKeys('input#inputFieldId', 'Text I want to be entered');. Here's its signature in source code: https://github.com/alwex/php-casperjs/blob/master/src/Casper.php#L293 Of course, that's for input field, for submit button - find it by its selector and click() it.