How to create a text file while doing android automation using Robotium - robotium

I am working on Robotium automation, my requirement is to create a text file or pdf file which contains some assertion report. But I can't generate the report using rock-bottom. Even I tried system. Out. println which is not printed in the console.
Please help me, How to approach it?
Thanks
Manikandan

You are not able to see print lines from Android. You can use logging to put messages to logCat. You can also save file for instance on sd-card (you will need permission in your manifest). Those links should help you with that:
How to save file to sd card
Writing a file to sdcard

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.

Saving a text file from external source to my app Objective C

Abstract Question here I guess
I have an idea for an app that parses .txt files and outputs info based on what is contained in the file. My question is how would I go about getting the text file into my app for example if the text file was attached to an email?
This is the only hurdle I have to get clear in my mind before I begin.
So here's a real life scernaio -
I have email with text file, I want to open my app and say import file.
I need to get that text file from my email into the app so I can manipulate it.
Not sure this is possible, hopefully somebody can let me know or suggest a workaround.
Thanks in advance!
Register your app to open a particular file type and ensure the attached file is identified as one of these file types (i.e. using mime type). You will probably want to use a unique file extension, other than .txt.

creating a file upload function with titanium

I'm supposed to develop a mobile app for moodle using android on titanium studio. And I have been searching for days for any helpful article on how to get a file chooser dialog to work on android. Most of the tutes offer image upload but I need to upload .pdf and zip files from mobile. I have already tried fileChooserDialog() and folderChooseDialog() to no avail. Help please?
There isn't a file chooser out of the box, as apps usually send files to each other internally. You can roll your own using ListViews though easily..
Build a list of all the files you're interested in. (https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem.File-method-getDirectoryListing)
Loop through the list omitting any file types you don't want and build the list
When the user selects a file capture the click event and upload that file.
Style however you want..

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

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.

PDF file custom zoom level

i have a task about .PDF files that pdf file should open in browser with custom zoom level of 125% or 150%, i tried many times, but it is not working properly in firefox, as it implements zoom on PDF file but it switch on page#2, i study the adobe's given parameters for PDF file and tried to use them as following in href,
"SICS-47.pdf?page=1&zoom=125,0,0"
"SICS-47.pdf#page=1&zoom=125,0,0"
but no success, anyone here can help me please ?
thank you so much in advance.
The adobe partner reference states on page 5 that this is for IE and Netscape. I'm not sure how old this document is, but you might want to check the Firefox support for this functionality as it could be incomplete.
Reference: Adobe Partner
Another thing you could do is modify the PDF content to make sure the document opens properly. Depending on which tool you're using you could use a free library like the Perl API2 library or a paid tool like the Java iText library. Maybe there are command line tools out there that do the same, but I'm not aware of them.