I am writing a script where I click on a button (Select Photo) which opens up a file upload (explorer) box. How am I to set my file name?
This is the code I'm using to click on the Select Photo button (ruby)
driver.find_element(:id, "fileUploadButton").click
I've seen some posts that says I do not need to click on the button but to send the path to the file/image I want to upload. So how would I upload a file on c:\temp\mypicture.jpg?
Here's my full and simple code.
driver.navigate.to "http://blah blah" #the real site is an internal site
driver.find_element(:id, "claimGiftButtonDesktop").click
sleep 5
driver.find_element(:id, "fileUploadButton").click
After clicking the fileUploadButton, that's when the explorer window will show. If I manually click on Open or double click on it, then a loading modal shows and the image is shown on the website.
Here is an IDE recording which works. I'm just having problems translating this into ruby.
open /PromoSite
click id=claimGiftButtonDesktop
click id=fileUploadButton
type id=fileInputElem #Value C:\\temp\\file.jpg
click id=viewProductPreviewButton
I've also added a screen shot. I click the button and the File Upload shows up. This should be something easy, so I must not be focusing on the correct id.
