self = <airgun.browser.AirgunBrowser object at 0x7f90a97e2d68>, locator = Locator(by='xpath', locator="//a[contains(@href, '/architectures/new')]"), args = (), kwargs = {}, vcheck = None, elements = []
def element(self, locator, *args, **kwargs):
"""Returns one :py:class:`selenium.webdriver.remote.webelement.WebElement`
See: :py:meth:`elements`
Returns:
:py:class:`selenium.webdriver.remote.webelement.WebElement`
Raises:
:py:class:`selenium.common.exceptions.NoSuchElementException`
"""
try:
vcheck = self._locator_force_visibility_check(locator)
if vcheck is not None:
kwargs['check_visibility'] = vcheck
elements = self.elements(locator, *args, **kwargs)
if len(elements) > 1:
visible_elements = [e for e in elements if self.is_displayed(e)]
if visible_elements:
return visible_elements[0]
else:
return elements[0]
else:
> return elements[0]
E IndexError: list index out of range
venv/lib/python3.6/site-packages/widgetastic/browser.py:337: IndexError
[...]
Following README.rst, when you run
pytest tests/foreman/ui_airgun/test_architecture.py
with this setup it works:But when I run the same on Firefox (firefox-58.0-4.fc27.x86_64, geckodriver-v0.19.1-linux64.tar.gz), it fails:
Error is: