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 🙂