vendredi 28 août 2015

File uploading error in codeception?

I'm trying to upload the file to the couple of input elements. The id attributes of these inputs are always generated randomly, so I receive a list of RemoteWebElements from my helper function:

function getInputFields() {
    $inputs = $this->getModule('WebDriver')->_findElements(['xpath' => "//input[@type='file']"]);
    return $inputs;
 }

Then, in the Cept I'm trying to upload the file, inserting the ID to XPath string

$pass = $I->getInputFields();
$path_to_input1 = "//*[@id='" . $pass[0]->getAttribute('id') ."']";
$I->attachFile($path_to_input1, '1.jpg');

I'm pretty sure that input element exists, and I get its ID correctly, checked by debug output. And getting this:

[ERROR - 2015-08-28T11:15:35.801Z] RouterReqHand - _handle.error - {"stack":"\tat _uploadFile ([native code])\n\tat \n\tat _postUploadFileCommand (:/ghostdriver/request_handlers/session_request_handler.js:212:30)\n\tat _handle (:/ghostdriver/request_handlers/session_request_handler.js:198:35)\n\tat _reroute (:/ghostdriver/request_handlers/request_handler.js:61:20)\n\tat _handle (:/ghostdriver/request_handlers/router_request_handler.js:78:46)","line":431,"sourceURL":""}

[Facebook\WebDriver\Exception\WebDriverException] JSON decoding of remote response failed.
Error code: 4
The response: 'Error - incompatible type of argument(s) in call to _uploadFile(); candidates were
_uploadFile(QString,QStringList)'

Can you please help me, where is the pitfall here?

Aucun commentaire:

Enregistrer un commentaire