當前位置: 首頁>>代碼示例>>Python>>正文


Python Keys.ARROW_DOWN屬性代碼示例

本文整理匯總了Python中selenium.webdriver.common.keys.Keys.ARROW_DOWN屬性的典型用法代碼示例。如果您正苦於以下問題:Python Keys.ARROW_DOWN屬性的具體用法?Python Keys.ARROW_DOWN怎麽用?Python Keys.ARROW_DOWN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在selenium.webdriver.common.keys.Keys的用法示例。


在下文中一共展示了Keys.ARROW_DOWN屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: clear_chat

# 需要導入模塊: from selenium.webdriver.common.keys import Keys [as 別名]
# 或者: from selenium.webdriver.common.keys.Keys import ARROW_DOWN [as 別名]
def clear_chat(self, name):
        self.browser.find_element_by_css_selector("._3FRCZ").send_keys(name+Keys.ENTER)
        menu_xpath = "/html/body/div[1]/div/div/div[4]/div/header/div[3]/div/div[3]/div/span"
        WebDriverWait(self.browser, self.timeout).until(EC.presence_of_element_located(
                (By.XPATH, menu_xpath)))
        menu = self.browser.find_element_by_xpath(menu_xpath)
        menu.click()
        chains = ActionChains(self.browser)
        for i in range(4):
            chains.send_keys(Keys.ARROW_DOWN)
        chains.send_keys(Keys.ENTER)
        chains.perform()
        clear_xpath = '//*[@id="app"]/div/span[2]/div/div/div/div/div/div/div[2]/div[2]'
        WebDriverWait(self.browser, self.timeout).until(EC.presence_of_element_located(
                (By.XPATH, clear_xpath)))
        self.browser.find_element_by_xpath(clear_xpath).click()



    # override the timeout 
開發者ID:VISWESWARAN1998,項目名稱:Simple-Yet-Hackable-WhatsApp-api,代碼行數:22,代碼來源:whatsapp.py

示例2: get_starred_messages

# 需要導入模塊: from selenium.webdriver.common.keys import Keys [as 別名]
# 或者: from selenium.webdriver.common.keys.Keys import ARROW_DOWN [as 別名]
def get_starred_messages(self, delay=10):
        starred_messages = []
        self.browser.find_element_by_css_selector("div.rAUz7:nth-child(3) > div:nth-child(1) > span:nth-child(1)").click()
        chains = ActionChains(self.browser)
        time.sleep(2)
        for i in range(4):
            chains.send_keys(Keys.ARROW_DOWN)
        chains.send_keys(Keys.ENTER)
        chains.perform()
        time.sleep(delay)
        messages = self.browser.find_elements_by_class_name("MS-DH")
        for message in messages:
            try:
                message_html = message.get_attribute("innerHTML")
                soup = BeautifulSoup(message_html, "html.parser")
                _from = soup.find("span", class_="_1qUQi")["title"]
                to = soup.find("div", class_="copyable-text")["data-pre-plain-text"]
                message_text = soup.find("span", class_="selectable-text invisible-space copyable-text").text
                message.click()
                selector = self.browser.find_element_by_css_selector("#main > header > div._5SiUq > div._16vzP > div > span")
                title = selector.text
                selector.click()
                time.sleep(2)
                WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, "div._14oqx:nth-child(3) > div:nth-child(1) > div:nth-child(1) > span:nth-child(1) > span:nth-child(1)")))
                phone = self.browser.find_element_by_css_selector("div._14oqx:nth-child(3) > div:nth-child(1) > div:nth-child(1) > span:nth-child(1) > span:nth-child(1)").text
                if title in _from:
                    _from = _from.replace(title, phone)
                else:
                    to = to.replace(title, phone)
                starred_messages.append([_from, to, message_text])
            except Exception as e:
                print("Handled: ", e)
        return starred_messages

    # Getting usernames which has unread messages 
開發者ID:VISWESWARAN1998,項目名稱:Simple-Yet-Hackable-WhatsApp-api,代碼行數:37,代碼來源:whatsapp.py

示例3: create_group

# 需要導入模塊: from selenium.webdriver.common.keys import Keys [as 別名]
# 或者: from selenium.webdriver.common.keys.Keys import ARROW_DOWN [as 別名]
def create_group(self, group_name, members):
        more = self.browser.find_element_by_css_selector("#side > header > div._20NlL > div > span > div:nth-child(3) > div > span")
        more.click()
        chains = ActionChains(self.browser)
        chains.send_keys(Keys.ARROW_DOWN+Keys.ENTER)
        chains.perform()
        for member in members:
            contact_name = self.browser.find_element_by_css_selector("._16RnB")
            contact_name.send_keys(member+Keys.ENTER)
        time.sleep(3) # little delay to make the process robust
        next_step = self.browser.find_element_by_css_selector("._3hV1n > span:nth-child(1)")
        next_step.click()
        group_text = self.browser.find_element_by_css_selector(".bsmJe > div:nth-child(2)")
        group_text.send_keys(group_name+Keys.ENTER) 
開發者ID:VISWESWARAN1998,項目名稱:Simple-Yet-Hackable-WhatsApp-api,代碼行數:16,代碼來源:whatsapp.py

示例4: bowhead

# 需要導入模塊: from selenium.webdriver.common.keys import Keys [as 別名]
# 或者: from selenium.webdriver.common.keys.Keys import ARROW_DOWN [as 別名]
def bowhead(self):
		self.driver.find_element_by_tag_name("body").send_keys(Keys.ARROW_DOWN) 
開發者ID:CharlesPikachu,項目名稱:AIGames,代碼行數:4,代碼來源:controller.py

示例5: test_select

# 需要導入模塊: from selenium.webdriver.common.keys import Keys [as 別名]
# 或者: from selenium.webdriver.common.keys.Keys import ARROW_DOWN [as 別名]
def test_select(self):
        from selenium.webdriver.common.keys import Keys
        from selenium.webdriver.support.ui import Select
        self.selenium.get(self.live_server_url + reverse('autocomplete_admin:admin_views_answer_add'))
        elem = self.selenium.find_element_by_css_selector('.select2-selection')
        elem.click()  # Open the autocomplete dropdown.
        results = self.selenium.find_element_by_css_selector('.select2-results')
        self.assertTrue(results.is_displayed())
        option = self.selenium.find_element_by_css_selector('.select2-results__option')
        self.assertEqual(option.text, 'No results found')
        elem.click()  # Close the autocomplete dropdown.
        q1 = Question.objects.create(question='Who am I?')
        Question.objects.bulk_create(Question(question=str(i)) for i in range(PAGINATOR_SIZE + 10))
        elem.click()  # Reopen the dropdown now that some objects exist.
        result_container = self.selenium.find_element_by_css_selector('.select2-results')
        self.assertTrue(result_container.is_displayed())
        results = result_container.find_elements_by_css_selector('.select2-results__option')
        # PAGINATOR_SIZE results and "Loading more results".
        self.assertEqual(len(results), PAGINATOR_SIZE + 1)
        search = self.selenium.find_element_by_css_selector('.select2-search__field')
        # Load next page of results by scrolling to the bottom of the list.
        for _ in range(len(results)):
            search.send_keys(Keys.ARROW_DOWN)
        results = result_container.find_elements_by_css_selector('.select2-results__option')
        # All objects and "Loading more results".
        self.assertEqual(len(results), PAGINATOR_SIZE + 11)
        # Limit the results with the search field.
        search.send_keys('Who')
        results = result_container.find_elements_by_css_selector('.select2-results__option')
        self.assertEqual(len(results), 1)
        # Select the result.
        search.send_keys(Keys.RETURN)
        select = Select(self.selenium.find_element_by_id('id_question'))
        self.assertEqual(select.first_selected_option.get_attribute('value'), str(q1.pk)) 
開發者ID:nesdis,項目名稱:djongo,代碼行數:36,代碼來源:test_autocomplete_view.py

示例6: test_select_multiple

# 需要導入模塊: from selenium.webdriver.common.keys import Keys [as 別名]
# 或者: from selenium.webdriver.common.keys.Keys import ARROW_DOWN [as 別名]
def test_select_multiple(self):
        from selenium.webdriver.common.keys import Keys
        from selenium.webdriver.support.ui import Select
        self.selenium.get(self.live_server_url + reverse('autocomplete_admin:admin_views_question_add'))
        elem = self.selenium.find_element_by_css_selector('.select2-selection')
        elem.click()  # Open the autocomplete dropdown.
        results = self.selenium.find_element_by_css_selector('.select2-results')
        self.assertTrue(results.is_displayed())
        option = self.selenium.find_element_by_css_selector('.select2-results__option')
        self.assertEqual(option.text, 'No results found')
        elem.click()  # Close the autocomplete dropdown.
        Question.objects.create(question='Who am I?')
        Question.objects.bulk_create(Question(question=str(i)) for i in range(PAGINATOR_SIZE + 10))
        elem.click()  # Reopen the dropdown now that some objects exist.
        result_container = self.selenium.find_element_by_css_selector('.select2-results')
        self.assertTrue(result_container.is_displayed())
        results = result_container.find_elements_by_css_selector('.select2-results__option')
        self.assertEqual(len(results), PAGINATOR_SIZE + 1)
        search = self.selenium.find_element_by_css_selector('.select2-search__field')
        # Load next page of results by scrolling to the bottom of the list.
        for _ in range(len(results)):
            search.send_keys(Keys.ARROW_DOWN)
        results = result_container.find_elements_by_css_selector('.select2-results__option')
        self.assertEqual(len(results), 31)
        # Limit the results with the search field.
        search.send_keys('Who')
        results = result_container.find_elements_by_css_selector('.select2-results__option')
        self.assertEqual(len(results), 1)
        # Select the result.
        search.send_keys(Keys.RETURN)
        # Reopen the dropdown and add the first result to the selection.
        elem.click()
        search.send_keys(Keys.ARROW_DOWN)
        search.send_keys(Keys.RETURN)
        select = Select(self.selenium.find_element_by_id('id_related_questions'))
        self.assertEqual(len(select.all_selected_options), 2) 
開發者ID:nesdis,項目名稱:djongo,代碼行數:38,代碼來源:test_autocomplete_view.py

示例7: press_down

# 需要導入模塊: from selenium.webdriver.common.keys import Keys [as 別名]
# 或者: from selenium.webdriver.common.keys.Keys import ARROW_DOWN [as 別名]
def press_down(self):
        warnings.warn(
            "deprecated; use `browser.element('#foo').type(Keys.ARROW_DOWN)` style instead",
            DeprecationWarning)
        return self.type(Keys.ARROW_DOWN) 
開發者ID:yashaka,項目名稱:selene,代碼行數:7,代碼來源:entity.py


注:本文中的selenium.webdriver.common.keys.Keys.ARROW_DOWN屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。