0

even if it looks file uploaded but it didn`t , can someone tell me how can i upload pdf file with cypress

cy.get("div.button").attachFile({ filePath:'form.pdf', mimeType:'application/pdf', encoding:"base64" }, {force:true, uploadType:"input"} )

enter image description here

aktibaba
  • 3
  • 1

1 Answers1

1

cy.get(div.button) seems like you are targetting the wrong element. The correct element must be of type input not type div

Take a close look at the HTML to find the correct selector

cypher_null
  • 632
  • 8
  • 22
  • Upload a PDF

    – aktibaba Dec 06 '21 at 16:35
  • this is the code until button, i cannot locate with input, sorry for sharing like this , domehow i could not include img – aktibaba Dec 06 '21 at 16:36
  • It's in the 2nd line of what you posted. Could you try ```cy.get('input.ng-pristine')``` for example? – cypher_null Dec 07 '21 at 07:21
  • I could handle one part of the pdf with your answer but not this one, I can locate it with cy.get('input.ng-pristine') but still the same thing, it shows uploaded but it didn't – aktibaba Dec 08 '21 at 04:38