【发布时间】:2018-04-30 20:43:26
【问题描述】:
我正在尝试单击左侧选项卡中的单选按钮“每月(最终)”。
请找到链接https://socds.huduser.gov/permits/index.html?
这是我尝试过的代码,
from selenium import webdriver
import time
chrome_path = r"/usr/bin/chromedriver"
driver = webdriver.Chrome(chrome_path)
driver.get("https://www.huduser.gov/portal/datasets/socds.html") # Hitting the Site
driver.maximize_window()
driver.find_element_by_xpath("""//*[@id="block-system-main"]/div[4]/div/div/div/div/form[5]/input""").click() #Clicking Buiding Permits Database
time.sleep(10)
### Not working ###
print driver.find_element_by_xpath("""/html/body/form/a[2]/input""").location # Getting the Location of the Element
Radio = driver.find_element_by_xpath("""/html/body/form/a[2]/input""") # Clicking Monthly Final Radio button
Radio.click()
driver.find_element_by_css_selector("body > form:nth-child(2) > a:nth-child(29) > input:nth-child(1)").click()
print "DONE"
【问题讨论】:
-
请在您的问题中提及问题,而不是在您的代码的 cmets 中。你还没有提到到底出了什么问题。
-
您在 xpath 中使用了
" " "。" " "被视为 cmets。 -
@PrakashPalnati,
"""string"""不是评论,而是一个简单的字符串
标签: python selenium radio-button