[英]Python Selenium image scraping to text
I am using selenium to scrape image to text from a website, and then put them into a csv file, http://www.58food.com/company_a1245289688.html
不知道 selenium 是否可以做到這一點? 非常感謝!!
driver.find_element_by_xpath('//*[@class="contact-text"]/d1/img[1]')
driver.find_element_by_xpath('//*[@class="contact-text"]/d1/img[2]')
and then..?
import urllib.request
import base64
imgsrc=driver.find_element_by_xpath('//*[@class="contact-text"]/d1/img[1]').get_attribute("src")
local_filename, headers = urllib.request.urlretrieve(src)
encoded_string = base64.b64encode(image_file.read())
檢索src,然后使用urllib獲取img,然后將其轉換為base64
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.