def stop_selenium(self):
     ''' get a final screenshot and quit selenium '''
     try:
         screenshots_home = os.getenv('TEST_HOME') + os.sep + "resources" + os.sep + "images" + os.sep + "screenshots" + os.sep
         screenshots_filename = "screenshot.jpg"
         test_name = ptest_utils.get_calling_test()
         if test_name != None:
             screenshots_filename = test_name + "_" + screenshots_filename
         self.get_screenshot("%s%s" % (screenshots_home, screenshots_filename)) 
     except Exception as inst:
         pass
         # log.error('error attempting to take screenshot in stop_selenium: %s' % inst)
     
     # quit selenium
     try:
         for handle in self.sel.window_handles:
             log.debug("switch to window '%s' and close it" % handle)
             self.sel.switch_to_window(handle)
             self.close()
         self.sel.quit()
         # kill any IE instances that might have gotten stuck - windows specific!
         #if self.browser.find("ie") >= 0:
         #    killer = IEKiller()
         #    killer.start()
     except Exception as inst:
         log.error('error attempting to quit selenium: %s' % inst)
Ejemplo n.º 2
0
 def stop_selenium(self):
     try:
         screenshots_home = os.getenv('TEST_HOME') + os.sep + "resources" + os.sep + "images" + os.sep + "screenshots" + os.sep
         screenshots_filename = "screenshot.jpg"
         test_name = ptest_utils.get_calling_test()
         if test_name != None:
             screenshots_filename = test_name + "_" + screenshots_filename
         self.get_screenshot("%s%s" % (screenshots_home, screenshots_filename)) 
     except Exception as inst:
         log.error('error attempting to take screenshot in stop_selenium: %s' % inst)
         
     self.sel.stop()
     # kill any IE instances that might have gotten stuck - windows specific!
     if self.browser.find("ie") >= 0:
         killer = IEKiller()
         killer.start()