Ejemplo n.º 1
0
    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))
Ejemplo n.º 2
0
 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']))
Ejemplo n.º 3
0
 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']))
Ejemplo n.º 4
0
    def testNumberOfLinksOnPage(self):
        d = selesame.analyze(url=self.getUrl("xpaths.html"),
                             driver=self.driver)

        self.assertEqual(3, len(d['http://example.com/']))
Ejemplo n.º 5
0
#!/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()
Ejemplo n.º 6
0
 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']))
Ejemplo n.º 7
0
 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']))
Ejemplo n.º 8
0
    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))
Ejemplo n.º 9
0
    def testNumberOfLinksOnPage(self):
        d = selesame.analyze(url = self.getUrl("xpaths.html"), driver = self.driver)

        self.assertEqual(3, len(d['http://example.com/']))
Ejemplo n.º 10
0
    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))
Ejemplo n.º 11
0
#!/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()
Ejemplo n.º 12
0
    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))