Exemplo n.º 1
0
 def start(self):
     """
     Starts the IEDriver Service. 
     
     :Exceptions:
      - WebDriverException : Raised either when it can't start the service
        or when it can't connect to the service
     """
     try:
         cmd = [self.path, "--port=%d" % self.port]
         if self.host is not None:
             cmd.append("--host=%s" % self.host)
         if self.log_level is not None:
             cmd.append("--log-level=%s" % self.log_level)
         if self.log_file is not None:
             cmd.append("--log-file=%s" % self.log_file)
         self.process = subprocess.Popen(cmd,
                 stdout=PIPE, stderr=PIPE)
     except TypeError:
         raise
     except:
         raise WebDriverException(
             "IEDriver executable needs to be available in the path. \
             Please download from http://code.google.com/p/selenium/downloads/list\
             and read up at http://code.google.com/p/selenium/wiki/InternetExplorerDriver")
     count = 0
     while not utils.is_url_connectable(self.port):
         count += 1
         time.sleep(1)
         if count == 30:
              raise WebDriverException("Can not connect to the IEDriver")
Exemplo n.º 2
0
    def __init__(self, executable_path='IEDriverServer.exe', 
                    port=DEFAULT_PORT, timeout=DEFAULT_TIMEOUT):
        self.port = port
        if self.port == 0:
            self.port = utils.free_port()

        try:
            self.iedriver = Service(executable_path, port=self.port)
            self.iedriver.start()
        except:
            # Create IE Driver instance of the unmanaged code
            try:
                warnings.warn("You need to download the IEDriverServer. \
                            Using the deprecated approach", DeprecationWarning)
                self.iedriver = CDLL(os.path.join(os.path.dirname(__file__),"win32", "IEDriver.dll"))
            except WindowsError:
                try:
                    self.iedriver = CDLL(os.path.join(os.path.dirname(__file__),"x64", "IEDriver.dll"))
                except WindowsError:
                    raise WebDriverException("Unable to load the IEDriver.dll component")
            self.ptr = self.iedriver.StartServer(self.port)

            seconds = 0
            while not utils.is_url_connectable(self.port):
                seconds += 1
                if seconds > DEFAULT_TIMEOUT:
                    # Clean up after ourselves
                    self.quit()
                    raise RuntimeError("Unable to connect to IE")
                time.sleep(1)

        RemoteWebDriver.__init__(
            self,
            command_executor='http://localhost:%d' % self.port,
            desired_capabilities=DesiredCapabilities.INTERNETEXPLORER)
    def start(self):
        """
        Starts the IEDriver Service.

        :Exceptions:
         - WebDriverException : Raised either when it can't start the service
           or when it can't connect to the service
        """
        try:
            cmd = [self.path, "--port=%d" % self.port]
            if self.host is not None:
                cmd.append("--host=%s" % self.host)
            if self.log_level is not None:
                cmd.append("--log-level=%s" % self.log_level)
            if self.log_file is not None:
                cmd.append("--log-file=%s" % self.log_file)
            self.process = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE)
        except TypeError:
            raise
        except:
            raise WebDriverException(
                "IEDriver executable needs to be available in the path. "
                "Please download from http://selenium-release.storage.googleapis.com/index.html "
                "and read up at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver"
            )
        count = 0
        while not utils.is_url_connectable(self.port):
            count += 1
            time.sleep(1)
            if count == 30:
                raise WebDriverException("Can not connect to the IEDriver")
Exemplo n.º 4
0
    def __init__(self,
                 executable_path='IEDriverServer.exe',
                 port=DEFAULT_PORT,
                 timeout=DEFAULT_TIMEOUT):
        self.port = port
        if self.port == 0:
            self.port = utils.free_port()

        try:
            self.iedriver = Service(executable_path, port=self.port)
            self.iedriver.start()
        except:
            # Create IE Driver instance of the unmanaged code
            try:
                warnings.warn(
                    "You need to download the IEDriverServer. \
                            Using the deprecated approach", DeprecationWarning)
                self.iedriver = CDLL(
                    os.path.join(os.path.dirname(__file__), "win32",
                                 "IEDriver.dll"))
            except WindowsError:
                try:
                    self.iedriver = CDLL(
                        os.path.join(os.path.dirname(__file__), "x64",
                                     "IEDriver.dll"))
                except WindowsError:
                    raise WebDriverException(
                        "Unable to load the IEDriver.dll component")
            self.ptr = self.iedriver.StartServer(self.port)

            seconds = 0
            while not utils.is_url_connectable(self.port):
                seconds += 1
                if seconds > DEFAULT_TIMEOUT:
                    # Clean up after ourselves
                    self.quit()
                    raise RuntimeError("Unable to connect to IE")
                time.sleep(1)

        RemoteWebDriver.__init__(
            self,
            command_executor='http://localhost:%d' % self.port,
            desired_capabilities=DesiredCapabilities.INTERNETEXPLORER)
Exemplo n.º 5
0
 def start(self):
     """
     Starts the IEDriver Service. 
     
     :Exceptions:
      - WebDriverException : Raised either when it can't start the service
        or when it can't connect to the service
     """
     try:
         self.process = subprocess.Popen([self.path, "--port=%d" % self.port],
                 stdout=PIPE, stderr=PIPE)
     except:
         raise WebDriverException(
             "IEDriver executable needs to be available in the path. \
             Please download from http://code.google.com/p/selenium/downloads/list\
             and read up at http://code.google.com/p/selenium/wiki/InternetExplorerDriver")
     count = 0
     while not utils.is_url_connectable(self.port):
         count += 1
         time.sleep(1)
         if count == 30:
              raise WebDriverException("Can not connect to the IEDriver")
Exemplo n.º 6
0
 def start(self):
     """
     Starts the IEDriver Service. 
     
     :Exceptions:
      - WebDriverException : Raised either when it can't start the service
        or when it can't connect to the service
     """
     try:
         self.process = subprocess.Popen(
             [self.path, "--port=%d" % self.port], stdout=PIPE, stderr=PIPE)
     except:
         raise WebDriverException(
             "IEDriver executable needs to be available in the path. \
             Please download from http://code.google.com/p/selenium/downloads/list\
             and read up at http://code.google.com/p/selenium/wiki/InternetExplorerDriver"
         )
     count = 0
     while not utils.is_url_connectable(self.port):
         count += 1
         time.sleep(1)
         if count == 30:
             raise WebDriverException("Can not connect to the IEDriver")
Exemplo n.º 7
0
    def start(self):
        """
        Starts the EdgeDriver Service.

        :Exceptions:
         - WebDriverException : Raised either when it can't start the service
           or when it can't connect to the service
        """
        try:
            cmd = [self.path, "--port=%d" % self.port]
            self.process = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE)
        except TypeError:
            raise
        except:
            raise WebDriverException(
                "The EdgeDriver executable needs to be available in the path. "
                "Please download from http://go.microsoft.com/fwlink/?LinkId=619687 "
            )
        count = 0
        while not utils.is_url_connectable(self.port):
            count += 1
            time.sleep(1)
            if count == 30:
                raise WebDriverException("Can not connect to the EdgeDriver")
Exemplo n.º 8
0
    def start(self):
        """
        Starts the EdgeDriver Service.

        :Exceptions:
         - WebDriverException : Raised either when it can't start the service
           or when it can't connect to the service
        """
        try:
            cmd = [self.path, "--port=%d" % self.port]
            self.process = subprocess.Popen(cmd,
                    stdout=PIPE, stderr=PIPE)
        except TypeError:
            raise
        except:
            raise WebDriverException(
                "The EdgeDriver executable needs to be available in the path. "
                "Please download from http://go.microsoft.com/fwlink/?LinkId=619687 ")
        count = 0
        while not utils.is_url_connectable(self.port):
            count += 1
            time.sleep(1)
            if count == 30:
                 raise WebDriverException("Can not connect to the EdgeDriver")