本文整理汇总了Python中selenium.webdriver.support.ui.Select.submit方法的典型用法代码示例。如果您正苦于以下问题:Python Select.submit方法的具体用法?Python Select.submit怎么用?Python Select.submit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.support.ui.Select
的用法示例。
在下文中一共展示了Select.submit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _take_step
# 需要导入模块: from selenium.webdriver.support.ui import Select [as 别名]
# 或者: from selenium.webdriver.support.ui.Select import submit [as 别名]
def _take_step(self, step):
"""Visit a url or fill a form and post it"""
if isinstance(step, URL):
self.get_nav_browser().get(step)
elif isinstance(step, Form):
form_url = step.url
form_data = step.data
self.get_nav_browser().get(form_url)
for elem_info in form_data:
elem = self.get_nav_browser().find_element_by_name(elem_info.name)
if elem_info.type == FormElemInfo.INPUT_TEXT:
elem.send_keys(elem_info.value)
elif elem_info.type == FormElemInfo.INPUT_SELECT:
elem = Select(elem)
elem.select_by_visible_text(elem_info.value)
elem.submit()
# wait for anything on the screen :)
self.wait()
示例2: Select
# 需要导入模块: from selenium.webdriver.support.ui import Select [as 别名]
# 或者: from selenium.webdriver.support.ui.Select import submit [as 别名]
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
import re
driver = webdriver.Chrome(executable_path="/Users/LAL/PycharmProjects/Python/WebScrapingWithPython/Chapter10_Scraping JavaScript/Selenium Tutorial/chromedriver")
driver.get("http://www.htmlcodetutorial.com/forms/_OPTION_SELECTED.html")
element = driver.find_element_by_xpath('//*[@id="node-272"]/div/div[1]/div/div/table[1]/tbody/tr[2]/td[2]/form/select')
select = Select(element)
select.select_by_visible_text("resistor array")
select.submit()
for option in select.options:
if option.text == "resistor array":
option.submit()
break