使用selenium chrome driver爬取敦煌网www.dhgate.com,想要获取店铺的地址和注册时间。
问题描述
使用find_element_by_class_name().text后发现不能获取span元素的文本内容,html如下:
Location Jiangsu, China (Mainland)
04:55 PM Sat Apr 23Member Aug 2012
解决方案:
使用get_attribute(‘innerHTML’)解决问题
location = driver.find_element_by_xpath('//*[@id="timeWrap"]/p/span[2]')
location = location.get_attribute('innerHTML')
location = re.findall(r"(.+)
", location)[0]



