class TestXpathForLocator(unittest.TestCase): def setUp(self): self._parser = LocatorParser(_FakeLibrary()) def test_escaping_quote(self): for inp in ['"', ' "" ', 'my link with " quote']: esc = inp.replace('"', '"') assert_equals(self._parser.locator_for(inp, 'a'), LINK_XPATH % (esc, esc, esc, esc, esc)) def test_escaping_less_than(self): for inp in ["<", " < < <", "my link with < less than"]: esc = inp.replace("<", '<') assert_equals(self._parser.locator_for(inp, 'a'), LINK_XPATH % (esc, esc, esc, esc, esc)) def test_add_locator_prefix(self): self._parser.add_strategy('jquery') locator = 'jquery=div.#my_select' assert_equals(self._parser.locator_for(locator, 'select'), locator)
def setUp(self): self._parser = LocatorParser(_FakeLibrary())