Hello again,
More one tip about filtering the element in an array, using some of the properties that you want (text content, position, id, class, html, etc…). In this example, I am finding the array of elements with the specific CSS and after I am returning the element where the property “TextContent” equals a Login.
menu = query("WebView index:0 css:'div li span'").find { |x| x["textContent"] == "Login" }
Or:
menu = query("WebView index:0 css:'div li span'", :textContent).find { |x|
x == "Login" }
In this other example, I am returning the element which contains specific text inside of the property “html“.
menu_figure = query("WebView index:0 css:'div li span'").find { |x|
x["html"].include? ("figure") }
Or:
menu_figure = query("WebView index:0 css:'div li span'", :html).find { |x|
x.include? ("figure") }
If you have any question/suggestion, just let me know.
Thank you guys ! See you next week 🙂
Hi,
I want to understand the logic in writing calabash query like query (“view marked:’——–‘”)
and we pass some property like :text :model from are we getting these parmeters .
Hi avaneesh,
this query will search the view wit the property marked equal “—“, if you pass some property in the query as :text or :model, you will have the result of the property of the element found.
Hi,
How to
assert text in hybrid android application.
help me!
Thank!
Hey, you will probably need to use javascript to find the web elements.