def _getAuthenticated(self, browser, url): """Getting authenticated This method may be overwritten. TODO: update to version 2 of the wrappers. Args: browser: The browser in which the user will be authenticated. url: The URL to get authenticated in. Returns: True or False. Raises: NoCredentialsException: If no valid credentials have been found. BadImplementationError: If an expected attribute is missing. """ # check if we have creds try: if len(self.creds) > 0: # TODO: in choosing a cred there is an uneeded nesting of arrays c = random.choice(self.creds)[0] # adding the credential browser.setNewPassword(c.user, c.password) return True else: raise NoCredentialsException(str(self)) except AttributeError as e: raise BadImplementationError(str(e))
def _getAuthenticated(self, browser): ''' Getting authenticated. This method will be overwritten. :param browser: The browser in which the user will be authenticated. ''' # check if we have creds if len(self.creds) > 0: # choosing a cred c = random.choice(self.creds) # adding the credential browser.setNewPassword(url, c.user, c.password) return True else: logger.debug("No credentials have been added and this platform needs them.") return False
def _getAuthenticated(self, browser): ''' Getting authenticated. This method will be overwritten. :param browser: The browser in which the user will be authenticated. ''' # check if we have creds if len(self.creds) > 0: # choosing a cred c = random.choice(self.creds) # adding the credential browser.setNewPassword(url, c.user, c.password) return True else: logger.debug("No credentials have been added and this platform needs them.") return False
def _getAuthenticated(self, browser, url): ''' Getting authenticated. This method will be overwritten. :param browser: The browser in which the user will be authenticated. :param url: The URL to get authenticated in. ''' # check if we have creds if len(self.creds) > 0: # TODO: in choosing a cred there is an uneeded nesting of arrays c = random.choice(self.creds)[0] # adding the credential browser.setNewPassword(url, c.user, c.password) return True else: logger.debug( "No credentials have been added and this platform needs them.") return False