自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 python爬虫:解决“ResultSet object has no attribute ‘%s‘问题

背景:使用python爬取豆瓣中某个贴子的评论中的邮箱。在实现获取分页数据时,遇到问题问题:先获取分页列表:page_list = bs4_obj.find_all("div",attrs={"class":"paginator"})得到的是'bs4.element.ResultSet'类型的结果使用for循环取出结果中的网址时,报错:for page_ele in page_list.find_all("a"): print(page_ele.attrs.get("hr

2022-02-22 10:39:41 1699

原创 爬虫时,报错‘utf-8‘ codec can‘t decode byte 0x8b in position 1: invalid start byte和乱码问题

背景:爬虫获取网页数据代码:运行时,显示乱码:使用F12查看网页的编码格式为utf-8于是,想要通过指定encoding=utf-8的方式修改,即:# content = page.content.decode("utf-8")# print(content)但再次运行会报如下错误:最终解决方案:去掉header中关于 accept-encoding的指定而且,通过测试还发现,header中只需要指定”User-Agent“即可,其他参数不必.

2022-02-21 20:10:07 1095 1

原创 解决:‘chromedriver‘ executable needs to be in PATH问题

背景:python 实现使用google浏览器打开百度首页代码如下:def login_baidu(): driver = webdriver.Chrome() driver.maximize_window() driver.implicitly_wait(2) driver.get("https://www.baidu.com/") time.sleep(5) driver.quit()问题:运行时,提示:'chromedriver' ex

2022-02-17 12:17:38 575

原创 Appium+python,app输入中文

appiumdesktop:1.9appium_python_client:2.1.2python:3.7.1手机:荣耀30s android10背景:在图库中搜索“元宵节”的图片问题:使用elemet.send_keys(u"元宵节"),在搜索框中输入“元宵节”时,显示乱码,即没有输入成功。,网上查阅,需要设置两个参数:des_cap["unicodeKeyboard"]=Truedes_cap["resetKeyboard"]=True但设置后,还是没有解决.

2022-02-15 15:47:32 1657

原创 appium+python:find_element_by_id方法被弃用,在pycharm中有删除线

appium desktop:1.8.2appium_python_client:2.1.2python:3.7.1使用find_element_by_id时,有删除线,提示被弃用解决方法:使用find_element()方法,在方法中指定定位元素的方式。看源码:方法需要有两个参数,一个是定位元素的方式,一个是元素值。例如,通过id定位,写法如下:driver.find_element(By.ID,"com.miui.gallery:id/more").

2022-01-19 10:49:20 6002

原创 Appium+python,使用tap点击坐标报错:Method has not yet been implemented

环境:appium desktop:1.8.2appium_python_client:2.1.2python:3.7.1android:9os:MIUI 11.0.5测试场景:打开相册,点击查看图片问题:针对相册模块录制UI自动化脚本,使用UIAutoMatorViewer获取元素控件时,发现通过class、xpath、id不能区分图片。所以,希望通过点击坐标的形式,实现打开图片。但在使用tap方法时,报错:Method has not yet been impleme

2022-01-18 21:58:38 3984

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除