Vrtgs / thirtyfour

Selenium WebDriver client for Rust, for automated testing of websites
Other
1.02k stars 72 forks source link

How to handle file picker? #209

Open zevtyardt opened 5 months ago

zevtyardt commented 5 months ago

I am currently working with this library and I am facing some difficulties in handling the file picker functionality. I would like to know the proper way to handle the file picker using this library. Could someone please provide guidance or code examples on how to achieve this? Thank you in advance for your help!

stevepryde commented 5 months ago

This is a difficult one. As far as I know, you can't automate this with webdriver/selenium or with the browser automation tools. The file picker is usually an OS-level window so it's kind of "outside" the browser. I've heard that you can use tools like autoit on Windows, but outside of that I don't really have any suggestions (and I've never used autoit).

zevtyardt commented 5 months ago

I use headless mode because my device cannot display the GUI window. I found a function in puppeteer node-js that can handle the file picker

https://pptr.dev/api/puppeteer.page.waitforfilechooser

Does this library have this kind of function?

stevepryde commented 5 months ago

I was not aware of this. Puppeteer (and others) tend to just wrap Chrome DevTools Protocol, which thirtyfour can also access (there are some CDP functions exposed already).

I don't know how it's done in puppeteer but I'd be interested in finding out. If it's using CDP then it may be possible in thirtyfour too, with some work.

zevtyardt commented 5 months ago

ok, thanks for the answer, I'm really looking forward to that feature