Exemple #1
0
 def select_random_option_to_vote(self):
     driver = self.driver
     wait_for_element(driver,
                      (By.CSS_SELECTOR, vote_list_on_vote_now_page_by_css),
                      timeout=60)
     click_element(driver,
                   (By.CSS_SELECTOR, vote_list_on_vote_now_page_by_css))
 def calculate_article(self):
     driver = self.driver
     wait_for_element(self.driver,
                      (By.CSS_SELECTOR, article_elements_by_css))
     article_elements = driver.find_elements_by_css_selector(
         article_elements_by_css)
     print("%s documents on the web page" % (len(article_elements)))
    def get_random_option_voted_times(self):
        driver = self.driver
        wait_for_element(driver, (By.CSS_SELECTOR, vote_list_on_voted_page_by_css))
        voted_text = driver.find_elements_by_css_selector(vote_list_on_voted_page_by_css)[random_num].text
        # get how many people to vote the random option
        voted_ticket_num = voted_text.split(' ', 1)[0]

        print("\n")
        print("%s people voted this option" % voted_ticket_num)
Exemple #4
0
    def get_random_option_voted_times(self):
        driver = self.driver
        # work-around: adjust to wait 60 seconds due to the flaky issue. this issue often occured in Jenkins
        wait_for_element(driver,
                         (By.CSS_SELECTOR, vote_list_on_voted_page_by_css),
                         timeout=60)
        voted_text = driver.find_elements_by_css_selector(
            vote_list_on_voted_page_by_css)[random_num].text
        # get how many people to vote the random option
        voted_ticket_num = voted_text.split(' ', 1)[0]

        print("\n")
        print("%s people voted this option" % voted_ticket_num)
Exemple #5
0
 def check_text_of_menu_title(self, expected_text):
     wait_for_element(self.driver, (By.XPATH, title_main_menu_xpath))
     actual_title_text = self.driver.find_element_by_xpath(
         title_main_menu_xpath).text
     return actual_title_text == expected_text
Exemple #6
0
 def fill_in_password(self, passwd):
     wait_for_element(self.driver, (By.ID, passwd_field_by_id))
     self.driver.find_element_by_id(passwd_field_by_id).send_keys(passwd)
     click_element(self.driver, (By.ID, passwd_next_button_by_id))
Exemple #7
0
 def fill_in_email(self, account):
     wait_for_element(self.driver, (By.ID, email_field_by_id))
     self.driver.find_element_by_id(email_field_by_id).send_keys(account)
     click_element(self.driver, (By.ID, email_next_button_by_id))
 def show_number_most_discussed(self):
     driver = self.driver
     wait_for_element(driver, (By.CSS_SELECTOR, num_most_discussed))
     most_discussed_element = driver.find_element_by_css_selector(
         num_most_discussed).text
     print([int(s) for s in most_discussed_element.split() if s.isdigit()])
 def click_polls(self):
     driver = self.driver
     wait_for_element(driver, (By.CSS_SELECTOR, polls_link_by_css))
     polls_menu_element = driver.find_element_by_css_selector(
         polls_link_by_css)
     driver.execute_script("arguments[0].click();", polls_menu_element)