Selenium 'WebElement' 对象没有属性 'Get_Attribute'
Selenium 'WebElement' object has no attribute 'Get_Attribute'
我将 Selenium webdriver (chrome) 与 Python 一起使用,我正在尝试从网页上的所有链接获取 href .当我尝试以下操作时:
items = driver.find_elements_by_tag_name("a")
print items
for item in items:
href = item.Get_Attribute('href')
print href
它设法获得了所有链接,但是在 get_attribute 我收到一个错误:
'WebElement' object has no attribute 'Get_Attribute'
虽然我到处都看它似乎应该有效。
"Get_Attribute" 属性 不存在,但 "get_attribute" 属性 存在:
items = driver.find_elements_by_tag_name("a")
print items
for item in items:
href = item.get_attribute('href')
print href
对于 python 输入字段如下:
nowText = driver.find_element_by_id("source").get_attribute("value")
print(nowText)
src = driver.find_element_by_css_selector("img").get_attribute("src")
我将 Selenium webdriver (chrome) 与 Python 一起使用,我正在尝试从网页上的所有链接获取 href .当我尝试以下操作时:
items = driver.find_elements_by_tag_name("a")
print items
for item in items:
href = item.Get_Attribute('href')
print href
它设法获得了所有链接,但是在 get_attribute 我收到一个错误:
'WebElement' object has no attribute 'Get_Attribute'
虽然我到处都看它似乎应该有效。
"Get_Attribute" 属性 不存在,但 "get_attribute" 属性 存在:
items = driver.find_elements_by_tag_name("a")
print items
for item in items:
href = item.get_attribute('href')
print href
对于 python 输入字段如下:
nowText = driver.find_element_by_id("source").get_attribute("value")
print(nowText)
src = driver.find_element_by_css_selector("img").get_attribute("src")