def test_equal_sign_is_split_into_by(self): self.assertEqual((By.ID, 'foo'), split_locator('identifier=foo')) self.assertEqual((By.ID, 'foo'), split_locator('id=foo')) self.assertEqual((By.NAME, 'foo'), split_locator('name=foo')) self.assertEqual((By.XPATH, 'foo'), split_locator('xpath=foo')) self.assertEqual((LOCATOR_JS, 'foo'), split_locator('js=foo')) self.assertEqual((LOCATOR_JQUERY, 'foo'), split_locator('jquery=foo')) self.assertEqual((By.XPATH, '//a[contains(string(.), "foo")]'), split_locator('link=foo')) self.assertEqual((By.CSS_SELECTOR, 'foo'), split_locator('css=foo'))
def test_move_area_between_regions(self): s = self.selenium s.click(u'link=Struktur') s.click(u'link=Regionen') module = self.get_module('body', 'Solo') s.waitForElementPresent(module) s.dragAndDropToObject(module, 'css=.action-cp-body-module-droppable', '10,10') s.waitForCssCount('css=.type-region', 2) region = s.selenium.find_elements(*split_locator('css=.type-region')) region = [x.get_attribute('id') for x in region] region = [x for x in region if x != 'feature'][0] s.dragAndDropToObject( 'css=#feature #informatives .dragger', 'css=#%s .landing-zone.action-cp-region-module-movable' % region, '10,10') s.waitForElementNotPresent('css=#feature #informatives') s.waitForElementPresent('css=#%s #informatives' % region)
def test_invalid_prefix_yields_none(self): self.assertEqual((None, 'bar=foo'), split_locator('bar=foo'))
def test_no_prefix_yields_none(self): self.assertEqual((None, 'foo'), split_locator('foo'))
def test_prefix_slashes_yields_xpath(self): self.assertEqual((By.XPATH, '//foo'), split_locator('//foo'))
def test_prefix_document_yields_js(self): self.assertEqual((LOCATOR_JS, 'document.getElementById("foo")'), split_locator('document.getElementById("foo")'))