def is_completed_app_link_displayed(self): Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.completed_app_link, maxWait=30) return Selenium.isElementCurrentlyDisplayed( driver=self.driver, xpath=SPARK_XPATH.completed_app_link)
def validate_storage_page(self): ''' Method to validate the contents of storage page :return: ''' Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.storage_header)
def load_executor_page(self): ''' Method to click on executor link and go to executor page :return: ''' Selenium.click_on_element_xpath(self.driver, SPARK_XPATH.executor_link) Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.executor_header)
def load_jobs_page(self): ''' Method to click on Jobs link and go to Jobs page :return: ''' Selenium.click_on_element_xpath(self.driver, SPARK_XPATH.job_link) Selenium.waitTillElementBecomesVisible(driver=self.driver, xpath=SPARK_XPATH.job_header)
def load_storage_page(self): ''' Method to click on storage link and go to storage page :return: ''' Selenium.click_on_element_xpath(self.driver, SPARK_XPATH.storage_link) Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.storage_header)
def load_shs_home_page(self): if not self.is_proxy: url = self.shs_direct_url else: url = self.shs_proxy_url self.driver.get(url) Selenium.waitTillElementBecomesVisible(driver=self.driver, xpath=SPARK_XPATH.spark_logo)
def go_to_incomplete_app(self): ''' Method to navigate to incomplete apps page :return: ''' Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.incomplete_app_link) Selenium.click_on_element_xpath(driver=self.driver, xpath=SPARK_XPATH.incomplete_app_link)
def validate_executor_page(self): ''' Method to validate the contents of executor page :return: ''' Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.executor_summary_table, maxWait=max_wait) assert Selenium.isElementCurrentlyDisplayed( driver=self.driver, xpath=SPARK_XPATH.executor_summary_table) assert Selenium.isElementCurrentlyDisplayed( driver=self.driver, xpath=SPARK_XPATH.executor_active_table)
def download_logs(self, app_id): [ os.remove(os.path.join("/tmp/", f)) for f in os.listdir("/tmp/") if f.startswith("eventLogs-") ] Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.log_download.format(app_id), maxWait=max_wait) Selenium.click_on_element_xpath( driver=self.driver, xpath=SPARK_XPATH.log_download.format(app_id)) from glob import glob result = glob('/tmp/eventLogs-{0}*.zip'.format(app_id)) sleep_time = 0 while len(result) <= 0 and sleep_time <= 10: time.sleep(1) sleep_time = sleep_time + 1 result = glob('/tmp/eventLogs-{0}*.zip'.format(app_id)) return len(result) > 0
def click_on_app(self, app_id): ''' Method to click on the spark app based on app id :param app_id: :return: ''' is_app_visible = Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.app_id.format(app_id), maxWait=max_wait) if not is_app_visible: self.driver.refresh() Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.app_id.format(app_id), maxWait=max_wait) Selenium.click_on_element_xpath(self.driver, SPARK_XPATH.app_id.format(app_id)) Selenium.waitTillElementBecomesVisible(driver=self.driver, xpath=SPARK_XPATH.job_header)
def is_summary_table_displayed(self): Selenium.waitTillElementBecomesVisible(driver=self.driver, xpath=SPARK_XPATH.summary_table) return Selenium.isElementCurrentlyDisplayed( driver=self.driver, xpath=SPARK_XPATH.summary_table)
def go_to_completed_app(self): Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.completed_app_link) Selenium.click_on_element_xpath(driver=self.driver, xpath=SPARK_XPATH.completed_app_link)