def setUp(self): # tạo ra 1 đối tượng (hay thể hiện) Castro và init nó self.screenCapture = Castro( filename='PYTHON/chapter_9/testSearchByCategory.swf') self.screenCapture.start() self.driver = webdriver.Chrome() self.driver.implicitly_wait(3) self.driver.maximize_window() self.driver.get('http://www.lazada.vn')
def record(path,rtime): #os.chdir(path) t = time.strftime("%Y_%m_%d") + time.strftime("_%H_%M_%S") c = Castro(filename = t + ".swf") c.init() c.start() print "Start recording--------" time.sleep(rtime) c.stop() return None
def setUp(self): # create an instance of Castro and provide name for the output file self.screenCapture = Castro(filename='testSearchByCategory.swf') # start the recording of movie self.screenCapture.start() # create a new Firefox session self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.driver.maximize_window() # navigate to the application home page self.driver.get('http://demo-store.seleniumacademy.com/')
def setUpClass(cls): current_dir = os.getcwd() if not os.path.exists(current_dir + '/selenium_test_raports/video_screencast'): os.makedirs('selenium_test_raports/video_screencast') cls.castro_recorder = Castro( host='mariusz-ThinkPad-T510', display=1, port=5901, clipping='1920x1080+0+0', framerate=30.0, filename=current_dir + '/selenium_test_raports/video_screencast/test_selenium.swf') cls.castro_recorder.start() cls.driver = webdriver.Chrome() cls.driver.maximize_window() cls.driver.get('https://simplebottleapp.herokuapp.com/')
from castro import Castro import subprocess, os, sys from subprocess import Popen, PIPE, STDOUT if sys.platform == "darwin": print 'launching slave process...' env = os.environ.copy() print env print sys.platform for x in range(1, 9): tc_name = "TC_%03d" % x # TC_001 TC_002 ... TC_008 c = Castro(display=1, passwd="/Users/labuser/.vinevncauth", filename=tc_name + "_screencast.swf") c.start() ruby = subprocess.call(['rake', tc_name], env=env) print ruby c.stop() else: if __name__ == '__main__': print 'launching slave process...' env = os.environ.copy() print env print sys.platform for x in range(1, 9): tc_name = "TC_%03d" % x # TC_001 TC_002 ... TC_008 c = Castro(display=1, filename=tc_name + "_screencast.swf") c.start() ruby = subprocess.call(['ruby', '-S', 'rake', tc_name], env=env) print ruby
from easyprocess import EasyProcess import pyscreenshot as ps from pyvirtualdisplay.smartdisplay import SmartDisplay, Display from castro import Castro import time count = 0 castro = Castro() castro.start() EasyProcess('google-chrome http://www.youtube.com') time.sleep(10) castro.stop()
def setUp(self): # Create an instance of Castro and provide name for the output file self.screenCapture = Castro(filename="testGoogleSearch.swf") # Start the recording of movie self.screenCapture.start() self.driver = webdriver.Firefox()