本文共 246 字,大约阅读时间需要 1 分钟。
之前分享了一个selenium提取属性值得方法:,这个方法很实用,可以将selenium获取得网页源码转成常用得BeautifulSoup格式,然后进行解析,今天用的时候看到一个更直接得方法,直接采用selenium自带得方法获取属性值,分享给大家:
driver = webdriver.Firefox()driver.get(url)driver.find_element_by_xpath('路径').get_attribute('href')
通过以上一行简单得代码就可以获取属性值了
转载地址:http://rxbhf.baihongyu.com/