UnicodeDecodeError: 'utf8' codec can't decode byte 0xe8

 

解决:

selenium传入中文时前面加u

browser.find_element_by_id("kw").send_keys(u"船长博客")

#!/usr/bin/python
# coding:utf-8
from selenium import webdriver
import time

browser = webdriver.Firefox()
browser.get("http://www.baidu.com")
browser.find_element_by_id("kw").send_keys(u"船长博客")
browser.find_element_by_id("su").click()
time.sleep(5)
browser.quit()

 

你可能感兴趣的:(UnicodeDecodeError: 'utf8' codec can't decode byte 0xe8)