Nosferican / WebDriver.jl

A WebDriver / JSON Wire Protocol Binding Compatible with Selenium for the Julia Language.
https://nosferican.github.io/WebDriver.jl/dev/
ISC License
42 stars 12 forks source link

screenshot feature to save as png #7

Closed kafisatz closed 4 years ago

kafisatz commented 4 years ago

I like you package. Thanks a lot.

In wonder whether you should implement a convenience function for the screenshot snippet. Is there any use case for the result of screenshot without that snippet?

maybe rename screenshot() to _screenshot()

using Base64
ss = write(joinpath(@__DIR__, "img.png"), base64decode(screenshot(session)))

#how about?
fi = "c:\\temp\\myfile.png"
function screenshot(fi,session) 
    ss = write(fi, base64decode(screenshot(session)))
    return ss
end
Nosferican commented 4 years ago

Thanks for the kind words and the useful suggestion. It seems the CI is not feeling well at the moment but once it is back again I will finish up #8 and tag a new release.

kafisatz commented 4 years ago

You are welcome. I note that I ran into a checkbox today, where click! failed. The error I got was something along "Element is not clickable at point (411, 675). Other element would receive the click:" I eventually succeeded with this

elm = Element(session, "css selector", cssidentifier)
script!(session, "arguments[0].click();", element)

Now I am wondering whether this is worth mentioning in the Readme.

Nosferican commented 4 years ago

Would have to investigate but I suspect that depends on the WebDriver implementation (e.g., Selenium 4). See SO about Selenium on that issue. I don't recall that being specified in the standard. I would hold on including it in the docs until I get a better sense of it. I might start a tutorial / examples section and then include it as implementation specific FAQ or such.