All threads / How I can upload some file on my automation Rails

Ask A Question

Notifications

You’re not receiving notifications from this thread.

How I can upload some file on my automation Rails

Jonatan Sporn asked in Ruby

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

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 39,609+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.