How do I write a test that download a file, and post it in a form.
it "should support download and upload a file", ->
upload = element(By.id 'UploadInput');
upload.sendKeys 'C:\\path\\to\\file\\file.txt'
Currently the upload works, but how do I download a file before and get it's path?
Solved it by adding the file to project and got the absolute path like this:
it "should support download and upload a file", ->
upload = element(By.id 'UploadInput');
upload.sendKeys path.resolve(__dirname, '../../assets/file.txt')
Related
I am building a flutter app (iOS/Android/MacOS/Windows/Web) which is able to download files, selected by the user. But where should I save those files? On MacOS/Windows its easy using path_provider and get the path of the downloads folder.
But where should I save the files on the other platforms? The downloads folder would be perfect because the users are able to use those files (.pdf) even without using the app, so the files are not app specific.
If you wish to save in download directory you can use
Directory appDownloadDir = await getDownloadsDirectory();
String appDownloadPath = appDownloadDir.path;
Or
getExternalStorageDirectory()//android
getApplicationDocumentsDirectory()// ios doesnt support access to download folder
I would like to create a ZIP file that is protected with a password.
Has anyone done this before and can you give me a few tips? I couldn't find a reasonable package on pub.dev.
Plugin archive
https://pub.dev/packages/archive
Use this plugin you can do like this:
final archive = ZipDecoder().decodeBytes(
_file,
verify: true,
password: "your_password", )
You can use this unpublished plugin flutter_zip_archive just download the code and use it. For better future development add the method channels from the repo to your app with the files included in the lib folder.
This package supports zipping and unzipping the files with passwords. It also provides the privilege of adding the destination where the zip file should be stored.
PS. To encrypt a file you'll need a file available locally before zipping.
i'm trying to simulate an upload file with protractor
i know that the protractor can't interact with OS window
and i created an EXE file (with autoit), that takes focus and insert a file .
when i'm testing manually everything working ok .
when i try to write it in protractor i get error
this is my protractor code ( using child_process ) -- see pic
Here is my error massage
tried using : NO LUCK!!
You don't need AutoIT to upload files. Just send full absolute path to file that you want to upload into upload input. If you are running tests with Selenium Grid you also need to use FileDetector to send file to node where test is running:
var FileDetector = require('selenium-webdriver/remote/index.js').FileDetector;
browser.setFileDetector(new FileDetector());
var path = require('path');
var fileToUpload = '../yourfile.txt',
absolutePath = path.resolve(__dirname, fileToUpload);
$('hiddenfileuploadinput').sendKeys(absolutePath)
Here is question that has answers that might help:
How to upload file in angularjs e2e protractor testing
I have faced the same error while working on mine. I had to open a .exe file using protractor. Putting the right path to .exe worked for me. Can you also re-check if it's the right path
I am using justboil image upload plugin on tinyMCE. I am able to upload image but that image instead of being uploaded to target folder “media” is uploaded to htdocs folder (xampp), means it does not even get uploaded to my root folder tutorials
$config['img_path'] = `C:\xampp\htdocs\tutorials\media`;
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . $config['img_path'];
where my code is going wrong?
You need to set the upload folder explicitly (https://github.com/vikdiesel/justboil.me/blob/master/config.php):
$config['img_path'] = '/images/somefolder'; // Relative to domain name
I am developing an application in which I am getting a zipped XML file from web service.
Now I need to unzip it and I have to parse it. How can I unzip an XML file coming from web service??? Is it necessary to save unzipped file (after unzipping) before taking it to parse or is there a code which gives unzipped file directly without saving it to documents directory?
Code for this is helpful.
Thanks in advance..