# How I can upload some file on my automation

**URL:** <https://www.ruby-forum.com/t/how-i-can-upload-some-file-on-my-automation/260321>\
**Category:** Deployment\
**Tags:** cucumber, capybara\
**Created:** [October 1, 2020, 7:28pm UTC](https://www.ruby-forum.com/t/how-i-can-upload-some-file-on-my-automation/260321 "2020-10-01T19:28:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![J\_SPORN](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bb73d2/32.png) [@J\_SPORN](https://www.ruby-forum.com/u/J_SPORN)\
**Post date:** [October 1, 2020, 7:28pm UTC](https://www.ruby-forum.com/t/how-i-can-upload-some-file-on-my-automation/260321/1 "2020-10-01T19:28:55Z")

</div>

Hi everyone, I need your help if is possible, on a tecnical doubt I have on my automation, I wrote the code below and the browser opened the window to choose the file I wants to upload:

find(:xpath, ‘//span[@id=“page:idFormUpload:j\_id138:0:reRenderUploadRow”]’).click  
But when I use the code below the automation get a error, the path of the file is “C:\Users\jsporn\Pictures\imagemTeste\_robo.png”, I don´t know if the sintax of this command are right or not, can anyone help me?

attach\_file Rails.root.join(“file”,‘C:\Users\jsporn\Pictures\imagemTeste\_robo.png’)  
Or this code below:

attach\_file(“attachments”, ‘C:/hughes/imagem\_robo\_CPF/imagemTeste\_robo.png’)

Thanks
