Selenium Webdriver (Chrome) and saving file in specific place under specific name (Python) - selenium-chromedriver

The script using Selenium gets the file from the site and w/o asking, of course, is saving it in Downloads under the name provided by the source.
How could I save a file in the specific place (other than Downloads) under specific name (defined by script), or, in the worst case - how can I get the name of the received file for required manipulations with its name, location and content?

Related

Download files from object storage in visual app of Oracle Visual Builder. How to use data from ATP Database to get dinamically the name of the files

I am trying to download specific files from the Object Storage in the Oracle Cloud in my Oracle Visual Builder App (my visual builder is inside OIC, Oracle Integration Cloud).
I'd like to use the name of the "File URL" column (see the picture above) as the file name of the file to download from the Object storage, but this file name should be different from every download button (again in the picture above, you can see that every download button should download the file that has the name of the value of the "File URL" column). The File URL column is the field of a business object which is linked to the SDP variable and the data arrives from an ATP database that is inside the Oracle Cloud Infrastructure. The column "First File" contains the Download buttons. In the properties of this button there is an ojAction event which is linked to an action chain (see picture below).
I followed this guide (Download from OCI Storage section) to download one file, but I mapped the "filename" input parameter with a fixed value (the name of an existing files inside the object storage). Now, I'd like to make the filename value dynamic, but I don't know how to create a variable that gathers all the values of the specific column (File URL) in the DB and how to pass the single value of this column to the filename parameter. I have tried to create an SDP type variable that gets only the File URL values, but it's not getting the values of the file names. Do you have suggestions or have you seen a guide that is maybe useful to solve this issue?
If I understood the problem correctly, you can't retrive the specific file URL linked to the row button the user click in order to download the right file.
If that's the case, then instead of using a button, you could use the "first-selected-row" event linked to the table itself; that will pass all the values of the selected row as parameter, and will allow you to link "$variables.rowData.fileURL" or whatever the field is called to the REST call.

Save As - html thymeleaf

we need to develop an application similar to the below
On the web page user is asked to select the parameters which are present in a Map<String,Boolean>. Once the user selects his choice of parameters then this Map is saved in a .DAT file. Right now I am saving it in C:/Users/Application. But I want the user to choose which directory he wants to save. I was tempted to use <input type="file".....> but it needs a file in the directory.
Is there any way that the user can specify his own directory where this .DAT file is saved.
Something similar to SaveAs..
A webpage cannot choose where the user will download a file that is returned. For some file types, the browser might even show the file instead of downloading it (e.g. PDF file).

PDFPrinter driver with ability for custom file name

Does anyone know of a PDF printer driver that allows you to programatically set the file name for printing/saving.
Im not sure if its possible with PDFCreator, but Im unable to figure it out.
So I am creating HTML Reports and have a print button to print it to PDF.
But now I have to automate it more so that it will be able to generate the PDF with a certain name. This without human interaction.
Win2PDF has several ways to do this.
The Auto-name feature can automatically name the PDF file, and can use the document title to name the files along with configurable date/time stamps. This can be configured with no changes to your program.
The file name can also be set by your program using the Windows API or by setting a string value in the registry named PDFDefaultFileName.

How to open a doc or pdf document from Odoo website?

How can we open a word document or pdf file by clicking on any link in Odoo? What are the steps need to be done?
1) Install module Document Management System (document).
2) Create directory (knowledge menu unit) or use existing one. Attach to this category required file (button "Attachments" above the form)
3) Since it was downloaded, it would generate an url. To access it: mouse right click on downloaded file - save url
4) Add the url to the website. Pressing it will download the file (publically available).
Note : Above Functionlity Work on odoo 8.
Document Management System module Remove in odoo 9 community and enterprice so this all file store in ir.attachment model.
So. Programatically, it is pretty much the same. The module 'document' allows to attach files to any object, including product.product (or product.template). So you have to find it:
attachment_ids = self.env['ir.attachment'].search([('res_model','=','product.product'),('res_id','=',product.id)]).
Where product.id - is id of needed product. E.g. you can store attachment_ids in product.product class as one2many field. After that you can get an url of any attachment. For example, for binary files:
for attach in attachment_ids:
url = 'https://yourcompany.com'+'/web/binary/saveas?model=ir.attachment&field=datas&filename_field=name&id='+str(attach.id)
This url may be easily added to the website product site, using foreach in product.attachment_ids

Selenium ide to locate a file and store its path info from any computer

currently in my test scripts for automated file upload to browser, the paths are already defined in the value column
command type
target //input[#type='file']
value /Users/.../.../.../filename.extension
in such cases, this script is unable to run on other computers because the path would be different.
my question will be is
is there a way to locate the file in a general folder (for example file is downloaded and in the "download" folder), by using selenium ide can we get the path of the file (/Users/.../downloads/filename.extension)
store the path of the file with its extension into a notepad which i will be using it for multiple test of file uploads later on.
right now if my colleague needs to run the script from his computer, he have to manually change the value to his path.
You could use a suite file that contains a "setup" file to only change the file name in 1 place and the variable is shared across tests in the suite. You could also select an agreed up on place to store the files: c:\test_info\image.jpg.
Or you can make the file available by URL & not local, Unfortunately javascript prevents that for security: How to get the current file path in javascript
Unfortunately I can't think of any other good way unless you all have the same path in a home directory and could do something like ~/test_dir/photo.jpg