0
I.attachFile('input[type=file]', 'test.txt');

I try attachFile function in codeceptjs/protractor. I getthis error.

TypeError: driver.execute is not a function

chromeDriver:2.33
selenium-standalone:3.7.1
codeceptJS:1.0.3

"output": "./e2e/codeceptjs_tests/reports",
"helpers": {
  "Protractor": {
    "url": "http://localhost:4200/",
    "driver": "hosted",
    "browser": "chrome",
    "rootElement": "body",
    "smartWait":5000, 

Error Pic

Code Scope

Barney
  • 1,851
  • 2
  • 19
  • 36
  • Please read why a [screenshot of HTML or code or error is a bad idea](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace. – undetected Selenium Apr 27 '18 at 07:45
  • Have you tried I.attachFile('input[type=file]', './test.txt'); – aefluke Feb 12 '20 at 11:42

2 Answers2

0

Try it with I.attachFile('input[type=file]', 'lega-client/test.txt');

j10
  • 109
  • 11
0

The syntax is right but you have to select the button in the first parameter not the field

I.attachFile('button','test.txt')