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

Reply
Join the discussion
Create an account Log in

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

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

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

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.