selenium - UnicodeEncodeError: 'charmap' codec can't encode character '\u20b9' in position 0: python -


i scrapping flipkart data here. data ₹40,999. how data.

these code problem:

for post2 in driver.find_elements_by_css_selector("._1vc4oe._2rq-nk"):     offer_price += [ post2.text ]     #print(offer_price)     print(offer_price) 

getting below error:

unicodeencodeerror: 'charmap' codec can't encode character '\u20b9' in position 0: character maps <undefined> 
full code: 
from selenium import webdriver selenium.webdriver.support.ui import webdriverwait selenium.webdriver.support import expected_conditions ec selenium.common.exceptions import timeoutexception selenium.webdriver.common.by import import time import csv chrome_path = r"c:\users\venkatesh\appdata\local\programs\python\python35\chromedriver.exe" driver = webdriver.chrome(chrome_path) regionidarray = ["https://www.flipkart.com/mobiles/pr?otracker=categorytree&page=1&sid=tyy%2c4io", "https://www.flipkart.com/mobiles/pr?otracker=categorytree&page=2&sid=tyy%2c4io"] mobile_link = [] mobile_name = [] offer_price = [] data_list=[] delay = 10 # seconds reg in regionidarray:     try:         driver.get(reg)         webdriverwait(driver, delay).until(ec.presence_of_element_located((by.xpath, "//*[@id='container']/div/div[2]/div[2]/div/div[2]/div/div[3]/div[1]/div/div[1]")))         driver.execute_script("window.scrollto(0, document.body.scrollheight);")         print("page ready")          post in driver.find_elements_by_class_name("_1uozlx"):             mobile_link += [ post.get_attribute("href") ]          post1 in driver.find_elements_by_class_name("_3wu53n"):             mobile_name += [ post1.text ]          post2 in driver.find_elements_by_css_selector("._1vc4oe._2rq-nk"):             offer_price += [ post2.text ]             #print(offer_price)             print(offer_price) 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -