コード例 #1
0
ファイル: service.py プロジェクト: venkatarajasekhar/Qt
 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")
コード例 #2
0
ファイル: webdriver.py プロジェクト: AnaPaulaRamos/X
    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)
コード例 #3
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://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")
コード例 #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)
コード例 #5
0
ファイル: service.py プロジェクト: AnaPaulaRamos/X
 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")
コード例 #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")
コード例 #7
0
ファイル: service.py プロジェクト: AM22/Pokemon-AI
    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")
コード例 #8
0
ファイル: service.py プロジェクト: nvonop/selenium
    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")