Im trying to download a file with perl's WWW::Selenium. I get a popup box asking me if I want to save/open the file. I want to manipulate it and say 'save' at some given location. Im not sure how this can be done. Please help.
P.S: I could not use WWW::Mechanize for this page and I have to use Selenium
Thanks a lot!
Selenium cannot handle the save box but a third party utility, AutoIt, can. What we do is have our testing code use selenium commands to click the download link, and then execute a compiled AutoIt script to save the file to the disk.
My understanding is that with selenium 1.x it can't be done, and has yet to be implemented in selenium 2 yet.
See,
http://www.jsystemtest.org/?q=node/70
and
http://wiki.openqa.org/display/SEL/Selenium+Core+FAQ#SeleniumCoreFAQ-Ican%27tinteractwithapopupdialog.Myteststopsinitstracks%21
Related
I want to automate the task of checking link by datewise, download the file and verify the excel sheet contents.
Steps:
1. Open URL. It will display the links of file(xxxx_130112_130208_xxx.xlsx).
2. click and download matched date link. It will download excel sheet.
3. Search the content and display report.
Please let me know if any idea regarding this. Can we automate this scenario.
-sri
You cannot do anything outside the browser. The only thing allowed is to use ClickOkOnNextConfirmation to click OK in dialog. But it will not work for saving the file. That's how Selenium IDE works.
Hopefully, Chris Noe, is in the house...
Selblocks is an extension for Selenium IDE that provides control-flow constructs such as if/then/else, looping and subroutines.
I'm trying to give interation over an XML file a whirl and am running into an error. It seems it can't find the XML file. The XML file is co-located with my Sel scripts. Please see the screenshot attached.
Is there a source for more documentation or examples? Like the sample test suite you have a picture of on the extension page?
Thanks,
Cameron
http://cl.ly/AzzT
I ran into the same issue, and the problem turned out to be that my XML was invalid. In my case it was because one of the parameters I was using was a url containing ampersands. Changing & to & fixed the problem for me, and the variables loaded perfectly.
So the website constantly changes the data that it displays, and I want to get that data every several seconds and log it in a spreadsheet. The problem is in order to get to the page, I have to have a cookie which I get when I log in. Unfortunately I only know how to program in MATLAB. MATLAB has a function for this, urlread, but it doesn't deal with cookies. What can I do to get to that page? Can anyone help me with this? Point me into a direction where a programing noob like me can succeed please.
You could use wget to download content while using HTTP cookies. I will be using StackOverflow.com as example target. Here are the steps to follow:
1) Obtain the wget command tool. For Mac or Linux, I think it is already available. On Windows, you can get it from the GnuWin32 project or from one of the many other ports (Cygwin, MinGW/MSYS, etc..).
2) Next we need to obtain an authenticated cookie by logging into the website in question. You can use your preferred browser for this.
In Internet Explorer, you can produce it using "File menu > Import and Export > Export Cookies". In Firefox, I used the Cookie Exporter extension to export cookies to text file. For Chrome, there should be similar extensions
Obviously you only need to do this step once, as long as the cookies have not yet expired!
3) Once you locate the cookie file exported, we can use wget to fetch the web page and provide it with this cookie. This of course can be performed from inside MATLAB using the SYSTEM function:
%# fetch page and save it to disk
url = 'http://stackoverflow.com/';
cmd = ['wget --cookies=on --load-cookies=./cookies.txt ' url];
system(cmd, '-echo');
%# process page: I am simply viewing it using embedded browser
web( ['file:///' strrep(fullfile(pwd,'index.html'),'\','/')] )
Parsing the web page is a whole other topic that I will not go into. Once you get the data you seek, you can interact with Excel spreadsheets using the XLSREAD and XLSWRITE functions.
4) Finally you can write this in a function, and make it execute on regular intervals using the TIMER function
Try using the java.net.* classes.
You should be able to use them directly in the MATLAB workspace, as described here: http://www.mathworks.co.uk/help/techdoc/matlab_external/f4863.html
Matlab has built-in functions for web downloading. For http sites, there is webread.m and websave.m. For FTPs, there is mget.m
We are using selenium ide tool in our project for testing the web application.
while executing, in the Login page we will give userid and password,
I need to extract those userid and passwords to an excel file.
I need add some script
can some body help me in this issue.
Radhika
Welcome to StackOverflow!
Extending the IDE using Selenium-RC is your quickest bet. Here is an excellent tutorial
You can make js file containing array for userid and passwords.
In that array you can store value which you want to pass.
Add that file as options > selenium IDE extension.
Now you can able to extract those values in your script.
I am automating test for a website using selenium, but selenium is not able to identify SWF components. Please let me know if there's a way to automate SWF components with Selenium & perl.
Here's the test link to check proof of concept:
http://demo.swfupload.org/v220/simpledemo/index.php
There is a Selenium-Flex API. I believe it requires instrumenting your swf files so that their controls are actually called by JavaScript, but includes a tool for doing that instrumentation.
I have not tried this, but might when I have some time...
EDIT:
Just noticed you referenced it not working for you in comments already. If you need to call it from perl it may indeed be impossible. I'd have to be a real user of it to know.
I encountered the same problem in automating a flash uploader widget in my own tests. Unfortunately, selenium cannot be used to automate run-of-the-mill flash SWF files.
If you want to upload something, then throw a script up on your server to which you can POST file data, and POST the data directly from your script (I am assuming that you are running selenium-rc). In any case, this is just working around the flash widget.