Telefonica / toolium

Wrapper tool of Selenium and Appium libraries to test web and mobile applications in a single project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Elements not found in nested groups

laura266 opened this issue · comments

When you have several nested groups the parent parameter is not correctly filled and sometimes the elements of a group cannot be found and "NoSuchElementException" is given.

Defined groups example:
class ThirdGroup(Group):
def init_page_elements(self):
self.element3 = Button(By.XPATH, './/button[@Class="three"]')

class SecondGroup(Group):
def init_page_elements(self):
self.element2 = ThirdGroup(By.XPATH, './/button[@Class="two"]')
self.test_element = Button(By.XPATH, './/button[@Class="two"]//button[@Class="three"]')

class FirstGroup(Group):
def init_page_elements(self):
self.element1 = SecondGroup(By.XPATH, './/button[@Class="first"]')

class ThisPageObject(PageObject):
def init_page_elements(self):
self.my_first_group` = FirstGroup(By.XPATH, '//div')

Elements accessing example:
visible1 = self.my_first_group.element1.element2.element3.web_element.is_displayed()
visible2 = self.my_first_group.element1.test_element.web_element.is_displayed()

That first line (visible1) gives a NoSuchElementException, but the last line (visible2) finds the element and returns the correct result. The element accessed in both cases has the same XPATH, but in the first case there is one more nested group than in the second one.

Hi @laura266,
The element parent was not correctly filled in nested groups.
I have released a new version (1.2.4) with this fix.
Thanks!