mayvenn / limo Goto Github PK
View Code? Open in Web Editor NEWA wrapper around selenium webdriver
License: Eclipse Public License 1.0
A wrapper around selenium webdriver
License: Eclipse Public License 1.0
Hi @jeffh and Mayvenn crew!
I'm evaluating limo for a project and have run into a problem with scroll-to
in Firefox. We have a position: fixed
header. In Firefox, limo's scroll-to
uses scrollIntoView()
. The default for scrollIntoView
is to scroll so "the top of the element will be aligned to the top of the visible area of the scrollable ancestor". With the fixed header, this puts the scrolled element under the header, where it isn't clickable.
scrollIntoView
accepts options to control how it scrolls. In my case, scrollIntoView(false)
, or equivalently scrollIntoView({block: "end", inline: "nearest"})
keeps the scrolled element on screen, because it tries to align the bottom of the element with the bottom of its ancestor. block: "center"
also works, though block: "nearest"
doesn't.
So, what do you think the best way to handle this would be? I can imagine scenarios where you'd need any one of the scroll behaviors. So maybe scroll-to
should be configurable. One tricky part is that click
and a few other helpers use scroll-to
, so you'd have to be able to pass the configuration through those helpers. And of course in Safari, Chrome and other browsers, limo uses the non-standard scrollIntoViewIfNeeded
, which doesn't support as many options as scrollIntoView
.
Some possibilities:
{block: "end", inline: "nearest"}
. This seems to be what gecko uses internally for testing. However, in other scenarios people suggest scrollIntoView(true)
, which is equivalent to {block: "start", inline: "nearest"}
. So, I worry that neither will work for everyone in all scenarios.binding
or alter-var-root
.scroll-to
and everything that uses it.I'm not really pleased with any of these. Do you have other ideas? If we settle on something, I'd be happy to submit a pull request.
Cheers!
What would be the best way to get the cookies from selenium driver?
Hi @jeffh
I have created the simple Leiningen template to create the project that use Limo quickly.
Could you add this link to the README.md or some where that you feel appropriate.
Cheers,
Burin
When click
calls wait-until-clickable
it doesn't pass the driver argument, so if you don't have a default *driver*
it fails with a NullPointerException
.
(defn click
([selector-or-element] (click *driver* selector-or-element))
([driver selector-or-element]
(scroll-to driver selector-or-element)
(wait-until-clickable selector-or-element)
(wait-for ["click" selector-or-element]
(.click (element driver selector-or-element))
true)))
Using version 0.2.0, trying to click on the zoom (+) button on a google map,
This works:
(let [zoom (limo/element driver {:xpath "//*[contains(@title,'Zoom in')]"})]
(.click zoom)))
This does not:
(let [zoom (limo/element driver {:xpath "//*[contains(@title,'Zoom in')]"})]
(limo.api/click driver zoom)))
The problem seems to have something to do with trying to scroll to the button:
1. Unhandled java.lang.NullPointerException
(No message)
Preconditions.java: 787 com.google.common.base.Preconditions/checkNotNull
FluentWait.java: 96 org.openqa.selenium.support.ui.FluentWait/<init>
WebDriverWait.java: 72 org.openqa.selenium.support.ui.WebDriverWait/<init>
WebDriverWait.java: 60 org.openqa.selenium.support.ui.WebDriverWait/<init>
api.clj: 116 limo.api/wait-until
api.clj: 103 limo.api/wait-until
api.clj: 106 limo.api/wait-until
api.clj: 103 limo.api/wait-until
api.clj: 104 limo.api/wait-until
api.clj: 103 limo.api/wait-until
api.clj: 250 limo.api/scroll-to
api.clj: 247 limo.api/scroll-to
api.clj: 267 limo.api/click
api.clj: 264 limo.api/click
api.clj: 265 limo.api/click
api.clj: 264 limo.api/click
bogeys.clj: 48 com.lemondronor.bogeys/dump1090-screenshot
bogeys.clj: 31 com.lemondronor.bogeys/dump1090-screenshot
REPL: 236 user/eval24080
REPL: 236 user/eval24080
Compiler.java: 6927 clojure.lang.Compiler/eval
Compiler.java: 6890 clojure.lang.Compiler/eval
core.clj: 3105 clojure.core/eval
core.clj: 3101 clojure.core/eval
main.clj: 240 clojure.main/repl/read-eval-print/fn
main.clj: 240 clojure.main/repl/read-eval-print
main.clj: 258 clojure.main/repl/fn
main.clj: 258 clojure.main/repl
main.clj: 174 clojure.main/repl
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 646 clojure.core/apply
core.clj: 641 clojure.core/apply
regrow.clj: 18 refactor-nrepl.ns.slam.hound.regrow/wrap-clojure-repl/fn
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 646 clojure.core/apply
core.clj: 1881 clojure.core/with-bindings*
core.clj: 1881 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 85 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 55 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 222 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 190 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 745 java.lang.Thread/run
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.