"Choose File" not work for firefox while it works for chrome - testing

I am using robotframework ,selenium2Library, selenium2 and python27 to test web program. It need to upload a file in my web program. I use Choose File to give file path value to input filed. But it is not work for firefox and it works fine in chrome. When I upload file manually in firefox, it works. It is a register page. Javascript code told that file upload field is empty when the form is trying to submit, since selenium seems did not give the file path to the value of file upload field. And other input fields all have been input values, no matter fields before this file upload filed nor those fields after it. Does anyone know how to solve this problem or is there any alternative solutions?

I've had success having selenium type the file path into the webpage directly. It works most of the time, but the site I use it on is being constantly updated and one week you can type a file path, the next week you can't, the following week you can again.
I say this as a precaution that this may not be the ultimate solution, but there are instances where it works. Your particular case may be able to use this method.
driver.find_element_by_name("FILE_UPLOAD_ELEMENT_NAME").send_keys(os.path.expanduser("~/PATH_TO_FILE"))
Feel free to find element by any other characteristic and replace the all caps parts be appropriate for your use.

Related

Why I can't find my database file in C: disc from DB Browser

I made database file called doctors.db in path given in following picture. I played with it in Command Prompt and it works perfect!
Now when I try to find it with program DB Browser for sqlite, you can see it is not possible to find it. Does someone know what the problem is? I am really surprised by this. I scrolled entire PC folder and still no sign of it..
Are you sure you've called it 'doctors.db', not just 'doctors'? The file type 'file' suggests it doesn't have its extension.

Display the pdf through a link in database

I am working presently on the adf side and I am stuck with some issues.
I have a page where I have to display the pdf files. The pdf files are in another site and the links are present in a column of the database.But when I try to access those links they are downloading rather than displaying. I need to display those pdf files in my inline frame rather than downloading.
I heard many suggestions like write a bean and put the file in session and get display them in page .But I am not clear.
So please help me on this.
I have a check box at the end and the checkbox should be enabled in my page only when the displayed pdf scrolled to end.
Please help me solving those issues.
When you create a link to a PDF there is only so much you can do to make it display in the browser. The most important thing you must do on the server that delivers the PDF is to make sure it is presented with the correct MIME-type and without a content-disposition header value of attachment.
After that, it's up to the browser to either show it in a browser tab or to download the file. I know Chrome will show the PDF in the browser when it's linked to, not sure if it also does that when it's linked in an iframe.
I don't think there's a reliable way to make it work the way you want, simply because it's very browser dependent.

Download Excel file from URL

Background
I am attempting to automate the downloading of an Excel file given a URL. I know how to do this, and realize there are many examples for how to do this using either the webbrowser or webclient control however my situation is somewhat different.
Problem
If I simply paste the URL into a normal browser, it will result in asking me to save / open the file like normal. When using the same URL with either the web browser or web client controls, it results in no file. I believe this is because the URL is simply a SharePoint link, that sends a request to get the file, but is not the actual file itself.
This can be done for security reasons or whatever the case is but I was wondering if anyone has ever found a way around this?
Perhaps a way to even just emulate the browser, then emulate clicking save?
The URL for the Excel file does NOT end in .xlsx, it ends in something like:
webclient/zhZZXYRyAaLUgD?TC_file=redirs/viewdataset
which is why I think the server simply processes the request and then provides the browser the file.
I am attempting to do this in VB.NET but VBA or VB answers seem like they should work as well.
Fiddler Results
I seemed to find an easy way to solve my problem. After downloading my file within Internet Explorer, and then viewing my recent downloads, IE has an option if you right click and select "Copy Download Link". This puts the true download URL in the clipboard and actually works using the My.computer.downloadfile method.

Coded UI Test - How to Pick multiple files from a location

I have some set of doc files(nearly 300+) which needs to be uploaded in a site. With Visual studio 2010 test automation, coded UI test, I have recorded the steps for a single file and when i run my code it worked.
Now, I want this to happen in loop, after uploading the 1st file, when the code runs again and when it hits the upload button it should pick the second file from my file location. How to code this ?
Any help would be appreciated.
Record and play back will work for one file that you recorded. You need to do some code changes by taking the recorded code and parameterize the files to the line of code.
First get the files from director
Use (Collection / Array) = Directory.GetFiles(#"FilePath"); //in C#
With this collection/array list you can pass arguments to your ui map code that you copied and repeat until all files get upload.

Why does my PDF ask for a password after being retrieved from Visual SourceSafe?

PREFACE: Yes we're moving away from VSS in the next few months.
One of my web projects contains, as one of its files, a PDF. The PDF on our QA site is being pulled from VSS.
A QA tester recently told me he's being prompted for a password when he tries to open it. VSS says the file I have on disk is different than the one it has, so I updated it, but afterwards it's still being shown as different.
So basically VSS is mangling my PDF and the results are so wobbly that Adobe Acrobat Reader is confused and thinks it has a password.
I've tried adding it as Auto-Detect and as Binary. Same results.
Why does my PDF ask for a password after being retrieved from Visual SourceSafe and how can I prevent it?
Do you have the SourceSafe 2005 Update installed?
Handy list of known issues: http://blogs.msdn.com/richardb/archive/2007/06/06/list-of-bugs-fixed-in-sourcesafe-2005-gdr.aspx
The PDF bug was one of the most commonly requested hotfixes: http://support.microsoft.com/kb/925234
I've tried adding it as Auto-Detect and as Binary. Same results.
To be clear, are you adding a version of the file you know is not already corrupted? Even so, there are plenty of other bug fixes on the list above which can cause random file corruption -- try that first.
You can remove PDF password by this tool:
Advanced PDF Password Remover 5.0
Step 1: Import PDF files
Click the "Add File(s)" button, browse your computer to find the PDF files and load them.You can import as many as 200 PDF files into this program for every batch processing.The imported files are listed in the file list window as below.
Step 2: Set output folder
You can customize a folder to save the output files all together. The default folder is My Documents\Advanced PDF Password Removerr. Click "Brows" button to specify a folder on your computer, or you can make a new folder manually in the text box.
Step 3: Remove restrictions
Click "Start" button, and the files are processed one by one.
"SUCCEED" is displayed in the Result column after the removing process is finished.