etaoin

jdt 2018-06-20T15:48:56.000393Z

@mrg, try some xpath? If you fire up your browser debugger and select the item you want to click, there's usually a right click option to show you the xpath to reach the element (at least in chrome).

2018-06-20T16:05:17.000218Z

thanks for the reply @dave.tenny

2018-06-20T16:05:23.000957Z

in my case the items get autogenerated by the frontend framework

2018-06-20T16:05:32.000254Z

so copying the xpath only gives me a random id

2018-06-20T16:05:59.000517Z

any idea what the xpath would look like for my example? Sorry, I don't usually use xpath

jdt 2018-06-20T16:06:08.000291Z

Usually I can use xpath patterns to match the hierarchy of entities and find the anchor/button/input I'm looking for

2018-06-20T16:06:26.000359Z

does that support an "nth" argument?

2018-06-20T16:06:37.000352Z

I think the docstring mentioned something about a [n] option in xpath

jdt 2018-06-20T16:06:45.000439Z

Dunno, would need to see the page, usually I start with the xpath that the debugger gives me and then generalize it with patterns if necessary.

jdt 2018-06-20T16:06:50.000580Z

(wildcards on path, etc)

2018-06-20T16:06:59.000546Z

//*id=ember8779[@""]

2018-06-20T16:07:02.000783Z

that's the browser xpath 🙂

2018-06-20T16:07:20.000774Z

unfortunately it's as correct as it's unhelpful

jdt 2018-06-20T16:07:50.000386Z

Maybe something like //a[@class='my-a-class'] or buttons/inputs/list elements, etc

jdt 2018-06-20T16:08:13.000834Z

and @class is some distinguishing property on the element in question that you can predict in advance

jdt 2018-06-20T16:09:00.000423Z

Barring that, you can also call (api/get-source driver), tease out what you want with java regular expressions, then compose some element ID to click on, which I'm often forced to do in extreme cases.

jdt 2018-06-20T16:09:18.000393Z

I'm not good with css though, and not very good with xpath either, but I almost always use xpath with etaoin

2018-06-20T16:10:20.000413Z

haha i'd rather not 🙂

2018-06-20T16:10:41.000158Z

i tried the suggested xpath but it doesn't work. But that's probably because i can't xpath

2018-06-20T16:10:53.000582Z

this ended up working: (click-el driver (nth (query-all driver (el :search :search-results)) 6))

2018-06-20T16:11:08.000115Z

I opened an issue about it: https://github.com/igrishaev/etaoin/issues/154

2018-06-20T16:12:07.000122Z

Oh, since you're here though, and you seem to have more experience than me, @dave.tenny:

2018-06-20T16:12:13.000938Z

Any idea on how to get full-length screenshots?

jdt 2018-06-20T16:13:41.000322Z

'fraid not. I mostly (spit "/tmp/page.html" (api/get-source driver)) and debug on the html

jdt 2018-06-20T16:14:12.000675Z

On that fragment above though, you might hit it with something like //ul/li/a

jdt 2018-06-20T16:14:21.000288Z

unless you have other such matches on the page

jdt 2018-06-20T16:14:50.000764Z

or //ul/li[@class='search-result']/a, or even omitting the 'a' entirely

jdt 2018-06-20T16:15:10.000588Z

oh, but I see you have multiple possible matches

jdt 2018-06-20T16:15:36.000585Z

in which case perhaps it's //ul/li[@class='search-result'][0]/a

jdt 2018-06-20T16:15:46.000549Z

or something like that, I definitely am not qualified to wing it

2018-06-20T16:28:09.000446Z

hm okay

2018-06-20T16:28:12.000324Z

thanks for the help!

2018-06-20T19:35:11.000096Z

Hi. Is there a way to flash a particular element like https://github.com/semperos/clj-webdriver/blob/508eb95cb6ad8a5838ff0772b2a5852dc802dde1/src/webdriver/core_element.clj#L62 ? Or... what is the etaoin way for testing a locator query to see if you have the right element? (It might not look like I'm here, but I do check periodically for responses)