def testFirefox(self): s = seleshot.create(webdriver.Firefox()) s.get("http://www.python.org") s.get_screen().save("imgF.png") os.remove("imgF.png") s.close()
def testDefault(self): s = seleshot.create() s.driver.get("http://www.python.org") s.get_screen().save("imgD.png") os.remove("imgD.png") s.close()
#!/usr/bin/env python # -*- coding: utf-8 -*- from selenium import webdriver from seleshot import create driver = webdriver.Firefox() driver.get('http://127.0.0.1:8000/webApp/') linkControls = driver.find_elements_by_tag_name('a') links = [] for linkControl in linkControls: links.append(linkControl.get_attribute('href')) driver.close() s = create() s.get_screen(url='http://127.0.0.1:8000/webApp/') for link in links: s.get_screen(url = link) s.close()
#!/usr/bin/env python ''' Created on Apr 13, 2012 @author: Marcin Gumkowski, Wojciech Zamozniewicz ''' import seleshot if __name__ == '__main__': s = seleshot.create() url = 'http://www.python.org' i = s.get_screen(url) i.cut_element(id = 'submit').save('cut1.png') i.cut_element(xpath = ".//*[@id='mainnav']/ul/li").save('cut2.png') i.cut_area(height = 100).save('area1.png') i.cut_area(200, 300, 250, 350).save('area2.png') i.cut_area(200, 300, 250, 350).cut_area(60, 60, 50, 50).save('area3.png') i.draw_frame(id = 'submit', padding = 10, color = 'yellow', size = 5).save('frame1.png') i.draw_frame(coordinates = (500, 500, 40, 50), color = 'green').save('frame2.png') i.cut_area(200, 300, 250, 350).draw_dot(coordinates = (50, 50), padding = (10, 4), color = 'yellow', size = 5).draw_dot(coordinates = (60, 20), padding = (10, 4), color = 'red', size = 10).save( 'dot1.png') i.draw_blur(id = 'submit').save('blur1.png') i.draw_blur(xpath = ".//*[@id='mainnav']/ul/li").save('blur2.png')
def setUp(self): self.s = seleshot.create()
def testWebDriver(self): d = webdriver.Firefox self.s = seleshot.create(d) self.assertIsInstance(self.s, webdriver.Firefox)
def testInstance(self): d = webdriver.Firefox() self.s = seleshot.create(d) self.assertEqual(self.s, d)
def testNone(self): self.s = seleshot.create() self.assertIsInstance(self.s.driver, webdriver.Firefox)