def testDriver(self): """ https://github.com/perfidia/selearea/issues/1 """ selearea.get_ast(self.getUrl("simple.html"), driver = self.driver) self.assertEqual(len(self.driver.find_elements_by_id("a")), 1)
def testDriver(self): """ https://github.com/perfidia/selearea/issues/1 """ selearea.get_ast(self.getUrl("simple.html"), driver=self.driver) self.assertEqual(len(self.driver.find_elements_by_id("a")), 1)
def get_fce_pages(self): urls = { "http://www.bis.put.poznan.pl/", "http://www.bis.put.poznan.pl/evPages/show/id/182" } return [get_ast(url) for url in urls]
def get_fc_pages(self): urls = { "http://fc.put.poznan.pl", "http://fc.put.poznan.pl/rekrutacja/post-powanie-kwalifikacyjne%2C29.html", "http://fc.put.poznan.pl/o-wydziale/witamy%2C39.html" } return [get_ast(url) for url in urls]
def testCheckCorrectnessOfXPaths(self): """ https://github.com/perfidia/selearea/issues/3 """ urls = [ "http://www.bis.put.poznan.pl/", "http://www.bis.put.poznan.pl/evPages/show/id/182" ] asts = [] for url in urls: asts.append(selearea.get_ast(url, driver = self.driver)) xpaths = selearea.get_workareas(asts) self.driver.get(urls[0]) for xpath in xpaths: self.assertIsNotNone(self.driver.find_element_by_xpath(xpath))
def testCheckCorrectnessOfXPaths(self): """ https://github.com/perfidia/selearea/issues/3 """ urls = [ "http://www.bis.put.poznan.pl/", "http://www.bis.put.poznan.pl/evPages/show/id/182" ] asts = [] for url in urls: asts.append(selearea.get_ast(url, driver=self.driver)) xpaths = selearea.get_workareas(asts) self.driver.get(urls[0]) for xpath in xpaths: self.assertIsNotNone(self.driver.find_element_by_xpath(xpath))
#!/usr/bin/env python # -*- coding: utf-8 -*- from selenium import webdriver from selearea import get_ast, get_workareas if __name__ == "__main__": urls = [ "http://www.bis.put.poznan.pl/", "http://www.bis.put.poznan.pl/evPages/show/id/182" ] driver = webdriver.Firefox() asts = [get_ast(url, driver) for url in urls] for workarea in get_workareas(asts): print workarea driver.close()
def test_get_none_page(self): with self.assertRaises(ValueError): get_ast(None)
def test_get_wrong_page(self): url = "putpoznan.pl" with self.assertRaises(ValueError): get_ast(url)
def get_identical_pages(self): urls = { "http://www.bis.put.poznan.pl/", "http://www.bis.put.poznan.pl/" } return [get_ast(url) for url in urls]