def __init__(self, driver, url): super(Wikipedia, self).__init__(driver, url) self.path = self.url.path self.headingText = TextElement(driver, Locator.by_id("firstHeading")) self.bodyText = TextElement(driver, Locator.by_id("bodyContent")) self.bodyTexts = TextElement( driver, Locator.by_css_selector("div#mw-content-text > div > p")) self.bogus_element = Element( driver, Locator.by_xpath("//foo")).mark_do_not_check()
def test_locator_by_id(self): """ Tests that can create Locator.by_id(path) :return: """ path = "//div/foobar" locator = Locator.by_id(path) assert locator != None assert locator.by == By.ID assert locator.value == path