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
def location(self): """Instance of Location entity.""" return LocationEntity(self.browser)