Home>

has an element like this:

how to pull a link?

browser: fire fox

@Jack_oS I took this screenshot as an example I just wondered how to pull the link

main2021-02-23 11:09:46
  • Answer # 1

    Something like this:

    links= [elem.get_attribute ('href') for elem in elems]
    
  • Answer # 2

    If you want a specific object

    Selecting an element

    link= driver.find_element_by_xpath ("/html /body /div [1] /header /div [3] /nav /a [2] /@ href")
    

    At the end, just add @href and it will return the link