[英]python find elements using selenium.webdriver
我想找到以下元素:
<input type="text" value="" action-data="text=郵箱/會員帳號/手機號" action-type="text_copy" class="W_input " name="username" ...
這是html標簽部分,有多個具有相同名稱和類屬性的input
。 所以我想使用normal_form
div屬性找到它。
此代碼不起作用:
browser.find_element_by_css_selector('input[action-type="text_copy"]')
我認為字段action-type
不是標准字段。
我能做什么?。 謝謝。
<div class="W_login_form" node-type="normal_form">
<div class="info_list" node-type="username_box">
<div class="inp username ">
<input type="text" value="" action-data="text=郵箱/會員帳號/手機號" action-type="text_copy" class="W_input " name="username" node-type="username" tabindex="1" maxlength="128" autocomplete="off">
</div>
</div>
我正在嘗試,這樣我就可以找到該元素。
browser.find_element_by_xpath("//div[@class='W_login_form']/div/div/input")
它首先使用類W_login_form
查找div
,然后查找div
和div
,最后獲取input
。
你有什么好主意嗎?
嘗試這個:
browser.find_element_by_xpath("//div[@class='info_list']//input")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.