element = driver.find_element_by_xpath(".//label[text()='散客']")
ticket_id = element.get_attribute("for")
print(ticket_id)
check = driver.find_element_by_xpath("./*//input[@id='{}']".format(ticket_id))
print(check.get_attribute("ID"))
check.click()
-------------------------------------------------
ctl00_ContentPlaceHolder1_chklstDiscounttypee_0
ctl00_ContentPlaceHolder1_chklstDiscounttypee_0
check.click()是失敗的,
driver.find_element_by_xpath("./*//input[@id='ctl00_ContentPlaceHolder1_chklstDiscounttypee_0]").click()
是成功的,很奇怪。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/205022.html
上一篇:出現 jump out of range 2 byte!的問題,求指教
下一篇:c#表單設計習題不會做
