我想从网站打印所有href(链接).所有这些href都存储在'a'标签中,这些标签存储在'li'标签中.现在,我知道如何选择所有的李.我需要一种方法来选择li中的所有a来获得'href'属性.试过以下但是没有真正奏效.
li = driver.find_elements_by_tag_name('li')
for link in li:
a_childrens = link.find_element_by_tag_name('a')
for a in a_children
(print a.get_attribute('href'))
Run Code Online (Sandbox Code Playgroud)
提前致谢.