Selenium 'WebElement' object has no attribute 'Get_Attribute'

后端 未结 3 1537
傲寒
傲寒 2021-01-11 10:02

I\'m using Selenium webdriver (chrome) with Python, I\'m trying to get the href from all the links on the webpage. When I try the following:



        
相关标签:
3条回答
  • 2021-01-11 10:43

    For python with input-field is like:

    nowText = driver.find_element_by_id("source").get_attribute("value")
    print(nowText)
    
    0 讨论(0)
  • 2021-01-11 10:58

    The "Get_Attribute" property doesn't exist, but the "get_attribute" property does:

    items = driver.find_elements_by_tag_name("a")
    print items
    
    for item in items:
        href = item.get_attribute('href')
        print href
    
    0 讨论(0)
  • 2021-01-11 11:02
    src = driver.find_element_by_css_selector("img").get_attribute("src")
    
    0 讨论(0)
提交回复
热议问题