def test_multiple_elements(self): test_list = ['one string', 'another string'] se = SeleniumElement(test_list, 'selector') self.assertEquals(se.replace('one', 'two'), 'two string') for i, elem in enumerate(se): self.assertEquals(elem, test_list[i])
def xpath(self, selector): return SeleniumElement(self.driver.find_elements_by_xpath(selector), selector)
def test_no_element_exception(self): se = SeleniumElement([], 'selector') with self.assertRaises(NoElementException): se.replace('one', 'two')
def css(self, selector): return SeleniumElement( self.driver.find_elements_by_css_selector(selector), selector)
def test_no_element_exception(self): se = SeleniumElement([], "selector") with self.assertRaises(NoElementException): se.replace("one", "two")
def test_multiple_elements(self): test_list = ["one string", "another string"] se = SeleniumElement(test_list, "selector") self.assertEquals(se.replace("one", "two"), "two string") for i, elem in enumerate(se): self.assertEquals(elem, test_list[i])