简体   繁体   中英

How can i find with android espresso web all the elements in Class name and choose what i need

I am trying to find the currency value in some class, the web using the class in couple of places. In web console I found it like this:

document.getElementsByClassName("casino-gaming-balance-replacer")[1].innerText

and get the value "£ 93.37"

In the android studio I used:

onWebView().withNoTimeout().withElement(findElement(Locator.CLASS_NAME, "casino-gaming-balance-replacer")).check(webMatches(getText(), containsString("X")));

but got nothing.

I want to see all elements in the class and save it in "String = Temp". How can i do it?

I recommend you to use Locator.XPATH
Just copy it from browser Inspector:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM