Skip to content

Instantly share code, notes, and snippets.

@els-pnw
Created January 13, 2012 15:44
Show Gist options
  • Save els-pnw/1607047 to your computer and use it in GitHub Desktop.
Save els-pnw/1607047 to your computer and use it in GitHub Desktop.
Troubleshooting iteration over elements
def find_system_by_name(self):
locator = (By.XPATH, "//div[@class='one-line-ellipsis']")
systems_in_list = [element.text for element in self.selenium.find_elements(*locator)]
return systems_in_list
#!/usr/bin/env python
import pytest
from unittestzero import Assert
from pages.home import Home
from pages.systems import Systems
import time
import sys
nondestructive = pytest.mark.nondestructive
destructive = pytest.mark.destructive
class TestSystems:
@nondestructive
def test_create_new_virt_system(self, mozwebqa):
home_page = Home(mozwebqa)
home_page.login()
Assert.true(home_page.header.is_user_logged_in)
home_page.tabs.click_tab("systems_tab")
Assert.true(home_page.is_the_current_page)
systems = Systems(mozwebqa)
new_system_name = systems.unique_system_name()
systems.create_new_virt_system(new_system_name)
system_list = systems.find_system_by_name
Assert.true(new_system_name in system_list())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment