Пример #1
0
    def _prepare_browser(self, url):
        """Starts the browser, navigates to satellite, performs post-init
        browser tweaks, initializes navigator and UI entities, and logs in to
        satellite.
        """
        if self._session_cookie:
            LOGGER.info(
                'Starting UI session id: %r from a session cookie',
                self._session_cookie.cookies.get_dict()['_session_id'],
            )
        else:
            LOGGER.info('Starting UI session %r for user %r', self.name, self._user)
        self._factory = SeleniumBrowserFactory(
            test_name=self.name, session_cookie=self._session_cookie, hostname=self._hostname
        )
        try:
            selenium_browser = self._factory.get_browser()
            self.browser = AirgunBrowser(selenium_browser, self)
            LOGGER.info(f'Setting initial URL to {url}')

            self.browser.url = url

            self._factory.post_init()

            # Navigator
            self.navigator = Navigate(self.browser)
            self.navigator.dest_dict = navigator.dest_dict.copy()
            if self._session_cookie is None and self._login:
                self.login.login({'username': self._user, 'password': self._password})
        except Exception as exception:
            self.__exit__(*sys.exc_info())
            raise exception
Пример #2
0
    def __enter__(self):
        """Starts the browser, navigates to satellite, performs post-init
        browser tweaks, initializes navigator and UI entities, and logs in to
        satellite.
        """
        LOGGER.info(u'Starting UI session %r for user %r', self.name,
                    self._user)
        self._factory = SeleniumBrowserFactory(test_name=self.name)
        selenium_browser = self._factory.get_browser()
        selenium_browser.maximize_window()
        self.browser = AirgunBrowser(selenium_browser, self)

        self.browser.url = 'https://' + settings.satellite.hostname
        self._factory.post_init()

        # Navigator
        self.navigator = copy.deepcopy(navigator)
        self.navigator.browser = self.browser

        # Entities
        self.activationkey = ActivationKeyEntity(self.browser)
        self.architecture = ArchitectureEntity(self.browser)
        self.location = LocationEntity(self.browser)
        self.login = LoginEntity(self.browser)
        self.operatingsystem = OperatingSystemEntity(self.browser)
        self.organization = OrganizationEntity(self.browser)
        self.subnet = SubnetEntity(self.browser)

        self.login.login({'username': self._user, 'password': self._password})
        return self
Пример #3
0
    def __enter__(self):
        """Starts the browser, navigates to satellite, performs post-init
        browser tweaks, initializes navigator and UI entities, and logs in to
        satellite.
        """
        LOGGER.info(
            u'Starting UI session %r for user %r', self.name, self._user)
        self._factory = SeleniumBrowserFactory(test_name=self.name)
        try:
            selenium_browser = self._factory.get_browser()
            selenium_browser.maximize_window()
            self.browser = AirgunBrowser(selenium_browser, self)

            self.browser.url = 'https://' + settings.satellite.hostname
            self._factory.post_init()

            # Navigator
            self.navigator = copy.deepcopy(navigator)
            self.navigator.browser = self.browser

            self.login.login({
                'username': self._user, 'password': self._password})
        except Exception as exception:
            self.__exit__(*sys.exc_info())
            raise exception
        return self
Пример #4
0
    def __enter__(self):
        selenium_browser = browser()
        selenium_browser.maximize_window()
        self.browser = AirgunBrowser(selenium_browser, self)

        self.browser.url = 'https://' + settings.satellite.hostname

        # Navigator
        self.navigator = navigator
        self.navigator.browser = self.browser

        # Entities

        self.architecture = ArchitectureEntity(self.browser)
        self.login = LoginEntity(self.browser)

        self.login.login({'username': self._user, 'password': self._password})
        return self