2
我想將文件上傳到幾個輸入元素。這些輸入的ID屬性始終隨機生成的,所以我收到我的助手功能RemoteWebElements列表:文件上傳錯誤的代碼中?
function getInputFields() {
$inputs = $this->getModule('WebDriver')->_findElements(['xpath' => "//input[@type='file']"]);
return $inputs;
}
然後,在CEPT我想上傳的文件,插入ID到XPath字符串
$pass = $I->getInputFields();
$path_to_input1 = "//*[@id='" . $pass[0]->getAttribute('id') ."']";
$I->attachFile($path_to_input1, '1.jpg');
我很確定輸入元素存在,我得到它的ID正確,由調試輸出檢查。 並獲得這樣的:
[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)'
能否請你幫我,這裏是這裏的陷阱?