Commit 82ea60cf authored by Arnaud Fontaine's avatar Arnaud Fontaine

Exclude hidden elements when looking in a listbox cell and don't allow

only input elements when getting a listbox control


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@44857 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d59d42f3
...@@ -314,9 +314,10 @@ class Browser(ExtendedTestBrowser): ...@@ -314,9 +314,10 @@ class Browser(ExtendedTestBrowser):
def getListboxLink(self, line_number, column_number, cell_element_index=1, def getListboxLink(self, line_number, column_number, cell_element_index=1,
*args, **kwargs): *args, **kwargs):
""" """
Follow the link at the given position. In case there are several Follow the link at the given position, excluding any link whose
links within a cell, C{cell_element_index} allows to select which class is hidden. In case there are several links within a cell,
one to get (starting from 1). C{cell_element_index} allows to select which one to get (starting
from 1).
@param line_number: Line number of the link @param line_number: Line number of the link
@type line_number: int @type line_number: int
...@@ -331,7 +332,8 @@ class Browser(ExtendedTestBrowser): ...@@ -331,7 +332,8 @@ class Browser(ExtendedTestBrowser):
@return: C{Link} at the given line and column number @return: C{Link} at the given line and column number
@rtype: L{zope.testbrowser.interfaces.ILink} @rtype: L{zope.testbrowser.interfaces.ILink}
""" """
xpath_str = '%s//tr[%d]//%s[%d]//a[%d]' % (self._listbox_table_xpath_str, xpath_str = '%s//tr[%d]//%s[%d]//a[not(contains(@class, "hidden"))][%d]' % \
(self._listbox_table_xpath_str,
line_number, line_number,
line_number <= 2 and 'th' or 'td', line_number <= 2 and 'th' or 'td',
column_number, column_number,
...@@ -683,8 +685,9 @@ class ContextMainForm(MainForm): ...@@ -683,8 +685,9 @@ class ContextMainForm(MainForm):
*args, **kwargs): *args, **kwargs):
""" """
Get the control located at line and column numbers (both starting Get the control located at line and column numbers (both starting
from 1). The position of a cell from a column or line number can from 1), excluding hidden control and those whose class is hidden
be obtained through calling too. The position of a cell from a column or line number can be
obtained through calling
L{erp5.utils.test_browser.browser.Browser.getListboxPosition}. L{erp5.utils.test_browser.browser.Browser.getListboxPosition}.
Also, there may be several elements within a cell, thus Also, there may be several elements within a cell, thus
...@@ -704,7 +707,8 @@ class ContextMainForm(MainForm): ...@@ -704,7 +707,8 @@ class ContextMainForm(MainForm):
@return: The control found at the given line and column numbers @return: The control found at the given line and column numbers
@rtype: L{zope.testbrowser.interfaces.IControl} @rtype: L{zope.testbrowser.interfaces.IControl}
""" """
xpath_str = '%s//tr[%d]//%s[%d]/input[%d]' % \ xpath_str = '%s//tr[%d]//%s[%d]/*[not(@type="hidden") and ' \
'not(contains(@class, "hidden"))][%d]' % \
(self.browser._listbox_table_xpath_str, (self.browser._listbox_table_xpath_str,
line_number, line_number,
(line_number <= 2 and u'th' or u'td'), (line_number <= 2 and u'th' or u'td'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment