def setup_module(module): _socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_proc = None try: _socket.connect((SERVER_ADDR, DEFAULT_PORT)) print ( "The remote driver server is already running or something else" "is using port %d, continuing..." % DEFAULT_PORT ) except: print ("Starting the remote driver server") RemoteApiExampleTest.server_proc = subprocess.Popen("java -jar selenium-server-standalone.jar", shell=True) time.sleep(5) print "Server should be online" webserver = SimpleWebServer() webserver.start() RemoteApiExampleTest.webserver = webserver RemoteApiExampleTest.driver = WebDriver(url, "firefox", "ANY")
def setup_module(module): _socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_proc = None try: _socket.connect((SERVER_ADDR, DEFAULT_PORT)) print( "The remote driver server is already running or something else" "is using port %d, continuing..." % DEFAULT_PORT) except: print("Starting the remote driver server") RemoteApiExampleTest.server_proc = subprocess.Popen( "java -jar selenium-server-standalone.jar", shell=True) time.sleep(5) print "Server should be online" webserver = SimpleWebServer() webserver.start() RemoteApiExampleTest.webserver = webserver RemoteApiExampleTest.driver = WebDriver(url, "firefox", "ANY")
def setup_module(module): _socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) url = "http://%s:%d/wd/hub" % (SERVER_ADDR, DEFAULT_PORT) try: _socket.connect((SERVER_ADDR, DEFAULT_PORT)) print ("The remote driver server is already running or something else" "is using port %d, continuing..." % DEFAULT_PORT) except: print ("Starting the remote driver server") RemoteApiExampleTest.server_proc = subprocess.Popen( "java -jar build/remote/server/server-standalone.jar", shell=True) assert wait_for_server(url, 10), "can't connect" print "Server should be online" webserver = SimpleWebServer() webserver.start() RemoteApiExampleTest.webserver = webserver RemoteApiExampleTest.driver = WebDriver(url, "firefox", "ANY")
def setup_module(module): _socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_proc = None url = "http://%s:%d/wd/hub" % (SERVER_ADDR, DEFAULT_PORT) try: _socket.connect((SERVER_ADDR, DEFAULT_PORT)) print ("The remote driver server is already running or something else" "is using port %d, continuing..." % DEFAULT_PORT) except: print ("Starting the remote driver server") RemoteApiExampleTest.server_proc = subprocess.Popen( "java -jar build/remote/server/server-standalone.jar", shell=True) assert wait_for_server(url, 10), "can't connect" print "Server should be online" webserver = SimpleWebServer() webserver.start() RemoteApiExampleTest.webserver = webserver RemoteApiExampleTest.driver = WebDriver(url, "firefox", "ANY")
def setup_module(module): webserver = SimpleWebServer() webserver.start() FirefoxCookieTest.webserver = webserver FirefoxCookieTest.driver = WebDriver()
def setup_module(module): webserver = SimpleWebServer() webserver.start() ChromeApiExampleTest.webserver = webserver ChromeApiExampleTest.driver = WebDriver()
def setup_module(module): webserver = SimpleWebServer() webserver.start() FirefoxApiExampleTest.webserver = webserver FirefoxApiExampleTest.driver = WebDriver()
driver.quit() driver = WebDriver() self.assertEquals([], driver.get_cookies()) driver.quit() def testCopyFromSource(self): dir_name = tempfile.mkdtemp() self._create_dummy_file(dir_name) profile = FirefoxProfile() profile.copy_profile_source(dir_name) profile_dir = profile.path dst_pref_file = open(os.path.join(profile_dir, self.DUMMY_FILE_NAME)) content = dst_pref_file.read() self.assertEquals(self.DUMMY_FILE_CONTENT, content) def _create_dummy_file(self, dir_name): pref_file = open(os.path.join(dir_name, self.DUMMY_FILE_NAME), "w") pref_file.write(self.DUMMY_FILE_CONTENT) pref_file.close() if __name__ == "__main__": logging.basicConfig(level=logging.INFO) webserver = SimpleWebServer(WEB_SERVER_PORT) webserver.start() try: unittest.main() finally: webserver.stop()
self.assertEquals(cookie, driver.get_cookies()[0]) driver.quit() driver = WebDriver() self.assertEquals([], driver.get_cookies()) driver.quit() def testCopyFromSource(self): dir_name = tempfile.mkdtemp() self._create_dummy_file(dir_name) profile = FirefoxProfile() profile.copy_profile_source(dir_name) profile_dir = profile.path dst_pref_file = open(os.path.join(profile_dir, self.DUMMY_FILE_NAME)) content = dst_pref_file.read() self.assertEquals(self.DUMMY_FILE_CONTENT, content) def _create_dummy_file(self, dir_name): pref_file = open(os.path.join(dir_name, self.DUMMY_FILE_NAME), "w") pref_file.write(self.DUMMY_FILE_CONTENT) pref_file.close() if __name__ == "__main__": logging.basicConfig(level=logging.INFO) webserver = SimpleWebServer(WEB_SERVER_PORT) webserver.start() try: unittest.main() finally: webserver.stop()