def testCorrectnesOfXPaths(self): d = selesame.analyze(url=self.getUrl("xpaths.html"), driver=self.driver) for v in d.itervalues(): for xpath in v: self.assertIsNotNone(self.driver.find_element_by_xpath(xpath))
def testCombinedUniqueLinks(self): d = selesame.analyze(url=self.getUrl("index.html"), driver=self.driver, mode="all", unique=False) prefix = self.driver.current_url.replace("index.html", "") self.assertEqual(0, len(d[prefix + 'test.html'])) self.assertEqual(2, len(d[prefix + 'duplicated.html'])) self.assertEqual(2, len(d[prefix + 'duplicated_script.html']))
def testOnclickLinks(self): d = selesame.analyze(url=self.getUrl("index.html"), driver=self.driver, mode="onclick", unique=True) prefix = self.driver.current_url.replace("index.html", "") self.assertEqual(0, len(d[prefix + 'test.html'])) self.assertEqual(0, len(d[prefix + 'duplicated.html'])) self.assertEqual(1, len(d[prefix + 'duplicated_script.html']))
def testNumberOfLinksOnPage(self): d = selesame.analyze(url=self.getUrl("xpaths.html"), driver=self.driver) self.assertEqual(3, len(d['http://example.com/']))
#!/usr/bin/env python # -*- coding: utf-8 -*- import selesame from selenium import webdriver if __name__ == '__main__': driver = webdriver.Firefox() print "selesame.analyze()" print selesame.analyze(url="http://www.xitro.eu", driver=driver) print print "selesame.get_same()" print selesame.get_same(url="http://www.xitro.eu", driver=driver, xpath="/html/body/footer/p") driver.close()
def testNoHTMLTag(self): d = selesame.analyze(url = self.getUrl("nohtmltag.html"), driver = self.driver) for v in d.itervalues(): for xpath in v: self.assertIsNotNone(self.driver.find_element_by_xpath(xpath))
def testNumberOfLinksOnPage(self): d = selesame.analyze(url = self.getUrl("xpaths.html"), driver = self.driver) self.assertEqual(3, len(d['http://example.com/']))
def testCorrectnesOfXPaths(self): d = selesame.analyze(url = self.getUrl("xpaths.html"), driver = self.driver) for v in d.itervalues(): for xpath in v: self.assertIsNotNone(self.driver.find_element_by_xpath(xpath))
#!/usr/bin/env python # -*- coding: utf-8 -*- import selesame from selenium import webdriver if __name__ == '__main__': driver = webdriver.Firefox() print "selesame.analyze()" print selesame.analyze( url = "http://www.xitro.eu", driver = driver ) print print "selesame.get_same()" print selesame.get_same( url = "http://www.xitro.eu", driver = driver, xpath = "/html/body/footer/p" ) driver.close()
def testNoHTMLTag(self): d = selesame.analyze(url=self.getUrl("nohtmltag.html"), driver=self.driver) for v in d.itervalues(): for xpath in v: self.assertIsNotNone(self.driver.find_element_by_xpath(xpath))