本文整理汇总了Python中selenium.webdriver.support.ui.Select.find_elements_by_tag_name方法的典型用法代码示例。如果您正苦于以下问题:Python Select.find_elements_by_tag_name方法的具体用法?Python Select.find_elements_by_tag_name怎么用?Python Select.find_elements_by_tag_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.support.ui.Select
的用法示例。
在下文中一共展示了Select.find_elements_by_tag_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_selenium_v_d_s_a_orig
# 需要导入模块: from selenium.webdriver.support.ui import Select [as 别名]
# 或者: from selenium.webdriver.support.ui.Select import find_elements_by_tag_name [as 别名]
def test_selenium_v_d_s_a_orig(self):
driver = self.driver
driver.get(self.base_url + "/vdsa-login.aspx")
driver.find_element_by_id("ctl00_ContentPlaceHolder1_txtUserName").clear()
driver.find_element_by_id("ctl00_ContentPlaceHolder1_txtUserName").send_keys(USERNAME)
driver.find_element_by_id("ctl00_ContentPlaceHolder1_txtPWD").clear()
driver.find_element_by_id("ctl00_ContentPlaceHolder1_txtPWD").send_keys(PASSWORD)
Select(driver.find_element_by_id("ctl00_ContentPlaceHolder1_ddlSelect")).select_by_visible_text("Meso Data")
driver.find_element_by_id("ctl00_ContentPlaceHolder1_btnSubmit").click()
Select(driver.find_element_by_id("ctl00_ContentPlaceHolder1_DropDownList1")).select_by_visible_text("India")
driver.find_element_by_css_selector("option[value=\"India\"]").click()
print "You are logged into the Meso dataset for India"
select = driver.find_element_by_id("ctl00_ContentPlaceHolder1_DropDownList2") #Captures state names
options = select.find_elements_by_tag_name("option")
optionsList = []
for option in options:
optionsList.append(option.get_attribute("value"))
for optionValue in optionsList:
if optionValue != "--Select--":
print "Downloading %s" % optionValue
select = Select(driver.find_element_by_id("ctl00_ContentPlaceHolder1_DropDownList2"))
select.select_by_value(optionValue)
checkboxes = driver.find_elements_by_xpath("//input[@type='checkbox']")
for checkbox in checkboxes:
checkbox.click()
driver.find_element_by_id("ctl00_ContentPlaceHolder1_RequestData").click()
select = driver.find_element_by_id("ctl00_ContentPlaceHolder1_GridView1") #Captures all download links
links = select.find_elements_by_tag_name("a")
linksList = []
for link in links:
linksList.append(link.get_attribute("value"))
for x in range(0,len(linksList)):
links[x].click()
time.sleep(DELAY)
time.sleep(DELAY)
driver.find_element_by_link_text("Back").click()