How do I get an element inside another element for iOS in Ruby?
Let’s say I have a UIATableCell and I want to find the first UIAStaticText inside that UIATableCell.
table_cell = UIATableCell
text = UIAStaticText
How would I write this without using xpath?
Aleksei
September 8, 2016, 5:28pm
2
try:
((IOSElement) driver.findElements(MobileBy.className("UIATableCell")).get(0)).
findElements(MobileBy.className("UIAStaticText")).get(0).getText();
You can use xpath axes like /descendant, child, /
etc.
Could an example be provided in Ruby?
If I write the following I’ll get this error message: '‘wrong number of arguments (1 for 0) (ArgumentError)’.
tags(“UIATableCell”)[1].text(3).attribute(“name”)
And when doing the following I get this error message: ‘undefined method `find_ele_by_attr_include’ for #[element]> (NoMethodError)’.
first_ele(“UIATableCell”).find_ele_by_attr_include(“UIAStaticText”, “name”, “string”)
I found out what the issue is with my approaches. It is only possible to find elements within elements when using find_element(s) and not by using e.g. “tag”, “first_ele” or others. Or so it seems.