1
import urllib.request
url='https://www.baidu.com/s?wd=海贼王'
res = urllib.request.urlopen(url)
UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 10-12: ordinal not in range(128)
原因:url包含不是ascii的字符
处理:把“海贼王”改为%+十六进制(法1:百度,法2 urllib.parse)
2
import urllib.request
headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36'}
url='https://www.baidu.com/s?wd=%E6%B5%B7%E8%B4%BC%E7%8E%8B'
res = urllib.request.urlopen(url,headers=headers)
TypeError: urlopen() got an unexpected keyword argument ‘headers’
原因:urlopen()不支持重构User-Agent响应对象
处理:先用urllib.request.Request(“网址”,headers=“字典”)创建请求对象
原因:POST data should be bytes 字符串参数没有编码
处理:
data = urllib.parse.urlencode(data)
data = bytes(data)
req = urllib.request.Request(url,data=data,headers=headers)
4
原因:被反爬
处理:使用正确的代理IP
https://blog.csdn.net/winterto1990/article/details/51217363
5
import base64
url = 'data:image/jpg;base64/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAC+ASUDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4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UOR7nTmearFw5IxskfeVFFFaniHJ/EHwWfHWgwaYNR+weVdLceZ5AlzhXXbjcP7+c57V5v/wAM5jv4pH4adj/2rXulFKyGpNbHhf8AwzkgbK+KSPrYZ/8AalPH7O5Gf+Kq/wDKf/8AbK9xopciK9pJdTxUfAKdYREPF8gQHIUWOAD9PMp6fAe6ifdF4uMZ9U04KfzEma9noo5EP2s+54u3wEkdiX8UK5bqX0/cT+JlNMP7PqkHHiXBPcWPP/oyva6KOVB7SXc8Nl/Z181Cp8Vde50/JH/kWvcqKKaViG7hRRRTEFFFFABRRRQAUUUUAZHiHQk8QWEVq8oj8uUSglN4yAR0yP71ctD8MQl59ol1ffxtKLahQFwRgDccda9AorRVZqPKnodFPFVqceWDsvkeen4WW/niZdQVJByHW2+bOAOfm5HGMVai+G9vb3a3UN9sk2bGTyMxt6kjdn1713FFNVppWuU8bXe8vyOXfwpdmEGPVIkuQxxKLTIK7cYK789cHqKoX3gnWLuxlhi8SrazShVaSKyOABvztBk+UncvIOfl9+O3orOUnJ3ZH1mr3POL74VyXhtydefMMXlBnhcscksTlZF/iZj6Y2jtk6WgfD1NCinA1WW5lm275JIlHTOMYPuepNdrRWjrTatcPrNW1rmJ/wAI/wDNk3Of+2f/ANetG+s/tsCx+Zsw27OM54Ix+tWqKzcmzOdSU/iPG/FPwBtPEGuTalaa5/Z/n/PLELPzAXPVh864z/PmsX/hmf8A6m7/AMpv/wBtr36ii7IPAR+zOR08Xf8AlN/+21Mn7OEsUiyx+MWWZSGWQaedykdCD5vB4Fe8UUnqFzx7UvgnqWqMZJ/FtuJnh8mWZdGQSSDuS3mZBI4JGMjg1hn9mjJz/wAJdz/2Df8A7bXvtFKKUVZDbbPAh+zRg5/4S7P103/7bXceDvhBpHhBRPHP9r1HnN3LDgrkYwgydoxnuTyeccV6LRVXEFFFFIAttCQAsiQotwsxujAwSy0JzgD/2QoK'
img_data = base64.b64decode(url) # 返回的是二进制数据
print(type(img_data))
binascii.Error: Incorrect padding
原因:经验
处理:去掉data:image/jpg;base64
6 .
print(soup.select(‘title’).string)
AttributeError: ResultSet object has no attribute ‘string’. You’re probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()
原因:select()返回的是列表
解决:print(soup.select(‘title’)[1].string)
7.
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=…port=443)
详见HelloWSFc的博客
8.
# driver.switch_to_frame(driver.find_element_by_id('iframe'))
# select标签
selectTag = Select(driver.find_element_by_class_name('nojs'))
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:“css selector”,“selector”:".nojs"}
原因:类为nojs的标签在iframe标签下
解决:
driver.switch_to.frame(driver.find_element_by_id('iframe'))
# select标签
selectTag = Select(driver.find_element_by_class_name('nojs'))
注:
那条杠仅仅表示switch_to_frame方法过时了,但还可以用
9.
interactable:可交互的
driver.find_element_by_id(‘wrapper’).send_keys(‘六翼’) # div标签
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
原因:div标签不能输入内容
10.
from selenium import webdriver
driver = webdriver.PhantomJS()
原因:没有配置驱动会报的错误
Message: ‘phantomjs’ executable needs to be in PATH.
解决: 找到驱动的绝对路径 或者添加到path环境变量当中 一劳永逸(可以添加到你python解释器的文件夹(Scripts)当中)
11.
driver = webdriver.Chrome()
原因:selenium模拟的客户端欲对浏览器操作,但相应浏览器的驱动版本不匹配
解决:跟新驱动,并复制到指定地址
12.
from selenium import webdriver
from selenium.webdriver.support.ui import Select
driver = webdriver.Chrome()
driver.get('https://www.17sucai.com/pins/demo-show?id=5926')
driver.switch_to.frame(driver.find_element_by_id('iframe'))
selectTag = Select(driver.find_element_by_id('dk_container_country-nofake'))
selenium.common.exceptions.UnexpectedTagNameException: Message: Select only works on elements, not on
import requests
from selenium import webdriver
import time
driver=webdriver.Chrome()
driver.get('https://xui.ptlogin2.qq.com/cgi-bin/xlogin?proxy_url=https%3A//qzs.qq.com/qzone/v6/portal/proxy.html&daid=5&&hide_title_bar=1&low_login=0&qlogin_auto_login=1&no_verifyimg=1&link_target=blank&appid=549000912&style=22&target=self&s_url=https%3A%2F%2Fqzs.qzone.qq.com%2Fqzone%2Fv5%2Floginsucc.html%3Fpara%3Dizone&pt_qr_app=%E6%89%8B%E6%9C%BAQQ%E7%A9%BA%E9%97%B4&pt_qr_link=http%3A//z.qzone.com/download.html&self_regurl=https%3A//qzs.qq.com/qzone/v6/reg/index.html&pt_qr_help_link=http%3A//z.qzone.com/download.html&pt_no_auth=0')
driver.find_element_by_class_name('face').click()
#time.sleep(2)
list1=driver.get_cookies()
cookie_1=[i['name']+'='+i['value'] for i in list1 ]
cookie_fianl='; '.join(cookie_1)
print(cookie_fianl)
url = 'https://user.qzone.qq.com/2023203294'
headers = {
# 'cookie':cookie_fianl,
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36'
}
html = requests.get(url,headers=headers)
time.sleep(2)
with open('测试.html','w',encoding='utf-8') as file_obj:
file_obj.write(html.text)
# print(html.text)
time.sleep(2)没有写时,发现cookie_final错误
所以以后要记住time.sleep(2)要勤写
15.
inputTag = driver.find_element_by_id('kw')
# 定位百度一下的按钮
buttonTag = driver.find_element_by_id('su')
actions = ActionChains(driver)
actions.send_keys_to_element(inputTag,'浩哥')
time.sleep(1)
# 普通点击行为不要在鼠标行为链里面出现
buttonTag.click()
actions.perform()#这一行报错
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
(Session info: chrome=90.0.4430.212)
原因:普通点击行为在鼠标行为链里面出现
解决:把他移到行为链外面
(下载图片的 Images Pipeline)
item[‘image_urls’]=‘https:’ + li.xpath(’./a/img/@src’).extract_first()
ValueError: Missing scheme in request url: h
原因:属于内部的构造的问题 要通过源码分析(门槛高)
解决:(加个括号)
item['image_urls']=['https:' + li.xpath('./a/img/@src').extract_first()]
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
如果你的xpath在谷歌控制台能够定位该标签,那么在pycharm里面报这个错误(元素不可交互)有可能是元素没找到。
最直接的方法就是强制加等待几秒钟就OK了。