def _setup_page(self):
        """Do sniffer settings and general settings
        """
        if not self.started:
            self.started = time.time()

        if time.time() - self.started > 5*len(settings.GOLDEN_DEVICES):
            self._browser.refresh()
            return

        # Detect Sniffer
        try:
            dialog = self._browser.find_element_by_id('capture-Setup-modal')
        except:
            logger.exception('Failed to get dialog.')
        else:
            if dialog and dialog.get_attribute('aria-hidden') == 'false':
                times = 100
                while times:
                    status = dialog.find_element_by_class_name('status-notify').text
                    if 'Searching' in status:
                        logger.info('Still detecting..')
                    elif 'Not' in status:
                        logger.warning('Sniffer device not verified!')
                        button = dialog.find_element_by_id('snifferAutoDetectBtn')
                        button.click()
                    elif 'Verified' in status:
                        logger.info('Verified!')
                        button = dialog.find_element_by_id('saveCaptureSettings')
                        button.click()
                        break
                    else:
                        logger.warning('Unexpected sniffer verification status')

                    times = times - 1
                    time.sleep(1)

                if not times:
                    raise Exception('Unable to detect sniffer device')

        time.sleep(1)

        try:
            skip_button = self._browser.find_element_by_id('SkipPrepareDevice')
            if skip_button.is_enabled():
                skip_button.click()
                time.sleep(1)
        except:
            logger.info('Still detecting sniffers')

        try:
            next_button = self._browser.find_element_by_id('nextButton')
        except:
            logger.exception('Failed to finish setup')
            return

        if not next_button.is_enabled():
            logger.info('Harness is still not ready')
            return

        # General Setup
        try:
            if self.child_timeout or self.sed_polling_interval:
                logger.info('finding general Setup button')
                button = self._browser.find_element_by_id('general-Setup')
                button.click()
                time.sleep(2)

                dialog = self._browser.find_element_by_id('general-Setup-modal')
                if dialog.get_attribute('aria-hidden') != 'false':
                    raise Exception('Missing General Setup dialog')

                field = dialog.find_element_by_id('inp_general_child_update_wait_time')
                field.clear()
                if self.child_timeout:
                    field.send_keys(str(self.child_timeout))

                field = dialog.find_element_by_id('inp_general_sed_polling_rate')
                field.clear()
                if self.sed_polling_interval:
                    field.send_keys(str(self.sed_polling_interval))

                button = dialog.find_element_by_id('saveGeneralSettings')
                button.click()
                time.sleep(1)

        except:
            logger.info('general setup exception')
            logger.exception('Failed to do general setup')
            return

        # Finish this page
        next_button.click()
        time.sleep(1)
def _setup_page ( self ) : if not self . started : self . started = time . time ( ) if time . time ( ) - self . started > 5 * len ( settings . GOLDEN_DEVICES ) : self . _browser . refresh ( ) return try : dialog = self . _browser . find_element_by_id ( 'capture-Setup-modal' ) except : logger . exception ( 'Failed to get dialog.' ) else : if dialog and dialog . get_attribute ( 'aria-hidden' ) == 'false' : times = 100 while times : status = dialog . find_element_by_class_name ( 'status-notify' ) . text if 'Searching' in status : logger . info ( 'Still detecting..' ) elif 'Not' in status : logger . warning ( 'Sniffer device not verified!' ) button = dialog . find_element_by_id ( 'snifferAutoDetectBtn' ) button . click ( ) elif 'Verified' in status : logger . info ( 'Verified!' ) button = dialog . find_element_by_id ( 'saveCaptureSettings' ) button . click ( ) break else : logger . warning ( 'Unexpected sniffer verification status' ) times = times - 1 time . sleep ( 1 ) if not times : raise Exception ( 'Unable to detect sniffer device' ) time . sleep ( 1 ) try : skip_button = self . _browser . find_element_by_id ( 'SkipPrepareDevice' ) if skip_button . is_enabled ( ) : skip_button . click ( ) time . sleep ( 1 ) except : logger . info ( 'Still detecting sniffers' ) try : next_button = self . _browser . find_element_by_id ( 'nextButton' ) except : logger . exception ( 'Failed to finish setup' ) return if not next_button . is_enabled ( ) : logger . info ( 'Harness is still not ready' ) return try : if self . child_timeout or self . sed_polling_interval : logger . info ( 'finding general Setup button' ) button = self . _browser . find_element_by_id ( 'general-Setup' ) button . click ( ) time . sleep ( 2 ) dialog = self . _browser . find_element_by_id ( 'general-Setup-modal' ) if dialog . get_attribute ( 'aria-hidden' ) != 'false' : raise Exception ( 'Missing General Setup dialog' ) field = dialog . find_element_by_id ( 'inp_general_child_update_wait_time' ) field . clear ( ) if self . child_timeout : field . send_keys ( str ( self . child_timeout ) ) field = dialog . find_element_by_id ( 'inp_general_sed_polling_rate' ) field . clear ( ) if self . sed_polling_interval : field . send_keys ( str ( self . sed_polling_interval ) ) button = dialog . find_element_by_id ( 'saveGeneralSettings' ) button . click ( ) time . sleep ( 1 ) except : logger . info ( 'general setup exception' ) logger . exception ( 'Failed to do general setup' ) return next_button . click ( ) time . sleep ( 1 )
Do sniffer settings and general settings