def __init__(self, profile=None, timeout=30): """Creates a webdriver instance. Args: profile: a FirefoxProfile object (it can also be a profile name, but the support for that may be removed in future, it is recommended to pass in a FirefoxProfile object) timeout: the amount of time to wait for extension socket """ self.browser = FirefoxLauncher() if type(profile) == str: # This is to be Backward compatible because we used to take a # profile name profile = FirefoxProfile(name=profile) if not profile: profile = FirefoxProfile() self.browser.launch_browser(profile) RemoteWebDriver.__init__(self, command_executor=ExtensionConnection(timeout), browser_name='firefox', platform='ANY', version='', javascript_enabled=True)
def __init__(self, port=DEFAULT_PORT, timeout=DEFAULT_TIMEOUT): self.port = port if self.port == 0: free_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) free_socket.bind((socket.gethostname(), 0)) self.port = free_socket.getsockname()[1] free_socket.close() # Create IE Driver instance of the unmanaged code self.iedriver = CDLL(os.path.join(os.path.dirname(__file__), "IEDriver.dll")) self.ptr = self.iedriver.StartServer(self.port) seconds = 0 while not self._is_connectable(): seconds += 1 if seconds > DEFAULT_TIMEOUT: raise RuntimeError("Unable to connect to IE") time.sleep(1) RemoteWebDriver.__init__(self, command_executor='http://localhost:%d' % self.port, browser_name='ie', platform='WINDOWS', version='')
def __init__(self): RemoteWebDriver.__init__(self, command_executor=ChromeDriver(), browser_name='chrome', platform='ANY', version='', javascript_enabled=True)