Esempio n. 1
0
class Application:
    def __init__(self, browser, base_url, username, password):
        if browser == "chrome":
            self.wd = webdriver.Chrome()
        elif browser == "firefox":
            self.wd = webdriver.Firefox()
        else:
            raise ValueError("Unknown browser: %s" % browser)
        # self.wd.implicitly_wait(5)
        self.session = SessionHelper(self)
        self.contact = ContactHelper(self)
        self.group = GroupHelper(self)
        self.filler = FillerHelper(self)
        self.base_url = base_url
        self.username = username
        self.password = password

    def is_valid(self):
        try:
            self.wd.current_url
            self.session.ensure_login(username=self.username,
                                      password=self.password)
            return True
        except:
            return False

    def destroy(self):
        self.wd.quit()
class Application:
    def __init__(self, browser, config):
        if browser == "chrome":
            self.wd = webdriver.Chrome()
        elif browser == "firefox":
            self.wd = webdriver.Firefox()
        else:
            raise ValueError("Unknown browser: %s" % browser)
        # self.wd.implicitly_wait(5)
        self.session = SessionHelper(self)
        self.filler = FillerHelper(self)
        self.navigation = NavigationHelper(self)
        self.mantis_project = MantisProjectHelper(self)
        self.james = JamesHelper(self)
        self.mail = MailHelper(self)
        self.signup = SignupHelper(self)
        self.soap = SoapHelper(self)
        self.config = config
        self.base_url = config["app"]["baseurl"]
        self.username = config["app"]["username"]
        self.password = config["app"]["password"]

    def is_valid(self):
        try:
            self.wd.current_url
            self.session.ensure_login(username=self.username,
                                      password=self.password)
            return True
        except:
            return False

    def destroy(self):
        self.wd.quit()