Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/Casper.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,29 @@ public function fillFormSelectors($selector, $data = array(), $submit = false)

return $this;
}
/**
* upload Files
* to the element matching the provided selector:
*
* @param string $selector
* @param array $data
*
* @return \Browser\Casper
*/
public function uploadFile($selector, $data = array())
{
$jsonData = json_encode($data);
$fragment = <<<FRAGMENT
casper.then(function () {
this.page.uploadFile('$selector', $jsonData);
});
FRAGMENT;

$this->script .= $fragment;

return $this;
}


/**
* Sends native keyboard events
Expand Down