【发布时间】:2015-12-14 18:14:05
【问题描述】:
我正在尝试单击页面上的多个下拉列表,但我不断收到错误消息,提示我的列表对象没有属性 tag_name'。
我的代码
def click_follow_buttons(driver):
selects = Select(driver.find_elements_by_class_name("jBa"))#jBa
print selects
for select in selects:
select.select_by_index(0)
driver.find_element_by_class_name("bA").click()
我的回溯
Traceback (most recent call last):
File "google_follow.py", line 50, in <module>
if click_follow_buttons(driver) == False:
File "google_follow.py", line 18, in click_follow_buttons
selects = Select(driver.find_elements_by_class_name("jBa"))#jBa
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/support/select.py", line 35, in __init__
if webelement.tag_name.lower() != "select":
AttributeError: 'list' object has no attribute 'tag_name'
HTML 下拉菜单
<div class="jBa XG">
<div class="ny dl d-k-l" jslog="7128; track:impression">
【问题讨论】:
标签: javascript python selenium