etaoin icon indicating copy to clipboard operation
etaoin copied to clipboard

docs: maybe explain date format required to fill input with date type

Open TimoKramer opened this issue 2 years ago • 4 comments
trafficstars

Version 1.0.40

Platform Operating System: Arch Linux Clojure version: 1.11.0 Babashka version: - JDK vendor and version: java-17-graalvm

Browser vendor: firefox Browser version: 116.0.3 WebDriver version: 0.32.2

Symptom e/fill does not work on {:tag :input}. It focuses it, you can see it as the first two numbers are blue but it does not enter anything. Does not work for e/fill-human as well.

Reproduction I am uploading an html for you to try this: (e/fill driver {:tag :input :name "cultivation-period"} "10222008") (e/fill driver {:tag :input :name "cultivation-period"} "10/22/2008")

Actual behavior date-input is not filled out

Expected behavior date-input is filled out

Testfile renamed to txt because htm is not allowed: yobst.htm.txt

Thanks so much for your work and any help is highly appreciated.

TimoKramer avatar Aug 22 '23 13:08 TimoKramer

Thanks for raising an issue @TimoKramer, I'll try to reproduce it locally sometime soon and get back to you.

lread avatar Aug 22 '23 13:08 lread

Apparently input type="date" fields are a bit picky as to what they accept.

I'm testing with Firefox 116.0.3 with geckodriver 0.33.0 matching your JVM via GraalVM CE 17.0.8+7.1 on Pop!OS.

Working from a fiddle directory, I copied your provided yobst.htm.txt to fiddle/issue558.html, then from a REPL I tried the following:

(require '[etaoin.api :as e]
         '[babashka.fs :as fs])

(def driver (e/firefox))

(e/go driver (->> "fiddle/issue558.html" fs/absolutize (str "file://")))

;; reproduced your experience
(e/fill driver {:tag :input :name "cultivation-period"} "10222008")

;; reproduced your experience
(e/fill driver {:tag :input :name "cultivation-period"} "10/22/2008")

;; yyyy-mm-dd seems to fill just fine
(e/fill driver {:tag :input :name "cultivation-period"} "2008-10-22")

(e/quit driver)

Can you try the yyyy-mm-dd format and see if that works for you?

lread avatar Aug 22 '23 14:08 lread

Works! :) Thank you! I could put up some update for the readme if that's of interest to you?!

TimoKramer avatar Aug 22 '23 14:08 TimoKramer

That's probably a good idea @TimoKramer, but I think I'd want to verify it works across all browsers * OSes that Etaoin supports. (The accepted date format is a function of the WebDriver and maybe the browser, not Etaoin itself).

We can leave this open as a reminder for me to add some tests/docs.

lread avatar Aug 22 '23 15:08 lread