代码输入文件ajax上传

I'm a newbie. I used chromedriver, I had a input type="file" and I use ajax file upload. Can I use Codeception to test it? How to do it? Thanks your help.

This is my sample code

view

<a href="javascript:;" id="upload_pic">
    <input type="file" class="fileupload" accept="image/*" name="pic" data-url="pic/upload_pic">
</a>

js

var upload_pic = function(obj) {
    ....
    $('.fileupload').fileupload({
        ....
    });
};

$('#upload_pic').click(function() {
    upload_pic(this);
});

I had try to use attachFile and executeJs, but not work for me

$I->attachFile('#upload_pic > input', 'aaa.jpg');
$I->executeJS('$("#upload_pic").trigger("click");');

edit

I try to click input type="file"

$I->click('//*[@id="upload_pic"]//input');

And I will get a error message

[Facebook\WebDriver\Exception\UnknowServerException] unknown error: Element is not clickable at point.....

Try to send ajax upload post data. In My case it was via Phpbrowser:

$I->sendAjaxPostRequest('/backstage/ajax/media_upload/',
    array('folder' => 'rfold', 'name' => 'velo.jpg', 'filename' => 'velo.jpg'));