Selenium RC upload file
can I upload files using 开发者_StackOverflowselenium RC
in IE?
The short answer is that in general you can't, due to browser security restrictions. Think about it, if Javascript code could programmatically upload a file to the server, it could send sensitive files to the server without the user ever noticing.
There are ways to work around it, as Niraj notes, but they involve using another tool to inject keypresses into the window system event queues. Also, you can run using the *chrome backend which is *firefox with lower security barriers.
Go through this post . will help you to upload file in selenium RC http://automationtricks.blogspot.com/2010/09/how-to-upload-file-in-selenium.html Thanks Niraj
You might try using the *iehta browser launcher instead of *iexplore. *iehta has heightened privileges. I use it to circumvent "Same Origin" restrictions, and comments in various forums I've read indicate that it might work for file upload as well.
I found that Autoit does the job but It failed for firefox so if else statement according to browser comes.
WinWaitActive("Choose File to Upload")
Send("C:\Images\abc.jpg")
Send("{ENTER}")
Type the above code in SciTE Script Editor of Autoit.
The "Choose File to Upload" is the title of the window when you click on button(Browse/Attach).
While Executing the code before click(Browse)
the code should be execute the exe file created by Compile Script to .exe
so that the code will wait for the popup and when the popup comes it selects the file to upload.
In firefox and other browsers you can upload a file just using type command of selenium.
See here http://aboutselenium.blogspot.com/2011/02/handling-file-upload-using-selenium.html
We can use Sikuli with selenium. If you are int interested in solution I can provide you better. Please explain your requirement in details.
精彩评论