def installAddon_cleanTabs_getLoginWindow(self, driver: WebDriver) -> None: """ 1) Install UblockOrigin 2) If any "welcome" windows open, close them 3) Click on login button """ driver.install_addon( f"{self.cfg['EXTENSIONS']['FOX_EXT_BASE_PATH']}/{self.cfg['EXTENSIONS']['UBO']}" ) driver.get(self.cfg["LOGIN"]["LOGIN_FROM"]) WebDriverWait(self.driver, 7).until( EC.presence_of_all_elements_located((By.TAG_NAME, "main"))) # wait for the page to load # Points to ww login-page MAIN_HANDLE: str = driver.current_window_handle for window_handle in driver.window_handles: if window_handle != MAIN_HANDLE: driver.switch_to.window(window_handle) # after closing all irrelevant tabs driver will focus back to the main one driver.close() # Puts focus back on ww login-page driver.switch_to.window(MAIN_HANDLE) # Use this stuff to setup the login window (You don't want any junk in some new tab) sleep(2) # click the first button on the page, it will make login button visible driver.execute_script( self.clickFirstElementFromElementList("button") + self.clickElementWithInnerTextS("button", "log in"))