CodeceptJS attachFile

Posted by itungnt on Sunday, July 22, 2018

Today I try to select the file for upload using CodeceptJS WebdriverIO helper.

I.attachFile(‘fieldName’, ‘path/file’);

My expectation is that the file input field will be filled with the file path but it wasn’t.

I try to debug by add the log to the helper configuration in codecept.json

“logLevel”: “verbose”,

“logOutput”: “test/output”,

Then I see the command was trigger, but what it did is upload the file directly to the web server.

[15:44:54] COMMAND POST “/wd/hub/session/27169f10-46c2-4843-b96e-91c3fc113c16/file”

[15:44:54] DATA {“file”:”[base64] 104428 bytes”}

[15:44:54] RESULT “iVBORw0KGgoAAAANSUhEUgAACWAAAAUSCAIAAAACZV2HAAAgAElEQVR4nOzdSYwcWX4f/t97L/bItTJrr2KxyGLvC3ub0UgjjUcaCLAM2LB08Uk6ylcDOkjCQAcDhg++GBYkwyfDgKANgmYE/fUX5NEI0ow0GnVPd3Pfa8/aMrNyiczIjPU9H6LIZpNsks3K4vr9gGg … (134982 more bytes)

[15:44:54] RESULT “/var/folders/hp/ft93xbcs02z92ljb2gpj9g6m0000gp/T/27169f10-46c2-4843-b96e-91c3fc113c16/upload5162489003344381447file/upload.png”


comments powered by Disqus