Uploading files with Selenide in fields input, type not file

165 views
Skip to first unread message

renata.b...@oitech.it

unread,
Jun 9, 2021, 3:55:04 AM6/9/21
to in...@selenide.org, sele...@googlegroups.com

Good morning,

I am a tester and I am trying Selenide after building some UI tests with Puppeteer.
I am finding Selenide very interesting as there are different features making tests faster and easier.

We are only facing one issue for which I couldn't find any solution on the web: on the site I am testing, there is an upload file box disabling the possibility of sending the file path as it was a string and the selector is an input but of type text, disabled:

So, using uploadFile or uploadFromClasspath nothing happens, so it seems that the script doesn't have errors on this, but the upload button is not enabled and the script crashes bescause of it.

Manually, the workflow is clicking on the clipboard or the Import file field and the file browser window is opened.

Is there a way to manage this through Selenide?

Thank you very much in advance

--

Renata Bertocchi
Quality Assurance

OITECH

Optima Information Technology Srl
Società a socio unico
Via Cavour 59
51100 Pistoia PT
Office +39 0573 195 0021
renata.b...@oitech.it
www.oitech.it
OITECH LINKEDIN

Capitale Sociale € 10.000 i.v.
P.Iva 03722491200
REA BO – 541470

Le informazioni contenute in questo messaggio di posta elettronica e nei files allegati sono da considerarsi strettamente riservate. Qualora riceveste questo messaggio senza esserne il destinatario, vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso eliminandolo dal vostro sistema. Costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003 trattenere il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo od utilizzarlo per finalità diverse. Portiamo inoltre alla Vostra attenzione che il presente messaggio, così come ogni risposta e/o altro/messaggio inviata all'account mittente saranno considerati di natura lavorativa e - come tali - possono essere conosciuti da altri soggetti appartenenti all'organizzazione cui appartiene il mittente.
The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on this is prohibited and may be unlawful. In this event please eliminate this e-mail from your system. Please note that this e-mail as well as any reply to the sender account will be considered as having corporate nature. Therefore they can be read by other people belonging to the sender's organization

Rispetta l'ambiente: se non ti è necessario, non stampare questo documento.
Please consider the environment before printing.

Andrei Solntsev

unread,
Jun 10, 2021, 6:51:02 AM6/10/21
to renata.b...@oitech.it, in...@selenide.org, selenide
I don't know the exact answer because it depends on your application. 
You need to investigate how exactly the button works. Typically there should be <input type="file"> somewhere in the DOM. Probably it's hidden. I guess you need to find this input and call method $.uploadFile() on it. 

Andrei Solntsev


ср, 9 июн. 2021 г. в 10:55, 'renata.b...@oitech.it' via selenide <sele...@googlegroups.com>:
--
You received this message because you are subscribed to the Google Groups "selenide" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenide+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenide/dfcf21f0-4bff-fff8-1680-00eb6e6dfb46%40oitech.it.
Reply all
Reply to author
Forward
0 new messages