etaoin

stask 2017-10-26T05:09:54.000016Z

hi, is there a way to click on a link with specific text? something like this (not working because there is no special handling for :text):

(click-visible driver {:tag :a :text "Forgot your password?"})

stask 2017-10-26T05:48:47.000117Z

changed q-xpath to support text queries so that q-expand generates this:

user> (ea/q-expand driver {:tag :a :text "Forgot your password?"})
["xpath" ".//a[text()='Forgot your password?'"]
but the visible?still returns false

gadfly361 2017-10-26T08:14:26.000143Z

Just a heads up, if any of you are using reagent ... then don't use the shorthand for classes. Etaoin will correctly find [:div {:class "foo"} "bar"] but it won't find [:div.foo "bar"]. I am assuming this is a problem with reagent and not Etaoin ... but it took me a while to make a guess and figure that out

borkdude 2017-10-26T08:53:28.000134Z

@gadfly361 How is this related to Reagent at all? It’s just syntax that is supported or not I think?

gadfly361 2017-10-26T09:14:27.000178Z

@borkdude the :tag.classname was sugar added by reagent. I am assuming whatever it is doing to convert to the attribute class has some slight difference than defining it in the attribute hash-map. I don't understand why that would be the case, but just describing what i observed

borkdude 2017-10-26T09:16:11.000201Z

@gadfly361 I don’t fully understand. It doesn’t matter how Reagent generated the dom nodes. This is unrelated to how etaoin selects them via xpath?

borkdude 2017-10-26T09:17:04.000034Z

You cannot just use Reagent shorthand syntax in etaoin, the implementation might differ, that’s what I mean

gadfly361 2017-10-26T09:22:11.000203Z

@borkdude Oh, sorry for not being clear, I would be using {:class "foo"} as the q in etaoin in either scenario

borkdude 2017-10-26T09:22:56.000246Z

@gadfly361 As long as the class is there in the DOM, it should not matter how Reagent does it right? At least, it works here

gadfly361 2017-10-26T09:23:27.000302Z

so let's say in etaoin i was using (wait-visible {:class "foo"}) against some html that was made in reagent using 1) [:div {:class "foo"} "bar"] 2) [:div.foo "bar"]

gadfly361 2017-10-26T09:23:41.000273Z

etaoin only finds 1) and not 2)

borkdude 2017-10-26T09:24:01.000193Z

If you do inspect element, what do you see in both cases?

gadfly361 2017-10-26T09:24:20.000180Z

that the class is there

borkdude 2017-10-26T09:26:28.000119Z

what if you try wait-exists instead of wait-visible

gadfly361 2017-10-26T09:56:46.000158Z

@borkdude you were correct to call BS 🙂 I reduced my problem to the following

(defn mycomp []
  [:div.foo
   {:class (string/join " "
                        (remove nil?
                                [nil
                                 nil]))}
   "bar"])
What I didn't realize is that the resulting class is foo instead of foo. the trailing whitespace got me 😁

borkdude 2017-10-26T09:57:24.000075Z

I didn’t call it BS? 😉

gadfly361 2017-10-26T09:57:28.000013Z

@borkdude I appreciate your help!!

borkdude 2017-10-26T09:57:58.000149Z

But etaoin could help with detecting classes being present instead of matching literally. I guess worth opening up an issue?

gadfly361 2017-10-26T10:04:12.000413Z

I think matching literally makes sense. Honestly, I don't want to ask too much of the maintainer since I am sure there is a lot on the roadmap. Thanks again for helping me figure that out ... I was about to strip out all the .classnames in my codebase hahah

borkdude 2017-10-26T10:14:30.000040Z

You can always fall back to xpath:

//div[contains(@class, 'some-class')]

👍 1
borkdude 2017-10-26T15:48:38.000106Z

Why does fill-el do (vec keys). I get a JsonGenerationException on this, like (cheshire.core/generate-string (vec “foo”))

borkdude 2017-10-26T15:52:20.000836Z

I’m not sure what’s going on though, it used to work for me

borkdude 2017-10-26T15:55:59.000285Z

Funny, when bringing in [cheshire "5.8.0"] it works again. I moved my integration tests to a standalone project and didn’t bring in that dependency. It might be a bug to convert the string into a vector @igrishaev?

borkdude 2017-10-26T15:58:28.000335Z

Ah, when not depending explicitly on cheshire, another dependency brings in an older version of cheshire, which could not yet handle a java Character.

2017-10-26T22:50:47.000106Z

Really cool library. Does it handle iframes?