上一页 1 2 3 4 5 6 7 8 9 ··· 15 下一页
摘要: 请求百度: <html> <form action="https://www.baidu.com/s" method="get"> <input type="text" name="wd" value="python" /> <input type="submit" name="submit" /> 阅读全文
posted @ 2020-03-16 13:34 mghhz816 阅读(1365) 评论(0) 推荐(0) 编辑
摘要: 1.打开终端,输入python -m pydoc -p 0,(0是让系统自动分配端口,也可以自己指定端口)会返回Server ready at http://localhost:63059/ 2.复制网址 http://localhost:63059/到浏览器运行 3,自带的函数都有,三方库下了哪些 阅读全文
posted @ 2020-03-08 16:08 mghhz816 阅读(1292) 评论(0) 推荐(1) 编辑
摘要: 运行python时出现报错 Element is not clickable at point (x, x). Other element would receive the click 报错原因:要点击的元素已经加载,但是界面没有显示出来,需要拉滚动条才能显示出来 程序如下: from selen 阅读全文
posted @ 2020-03-05 10:09 mghhz816 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 程序如下 import traceback import sys try: except Exception as e: print(sys._getframe().f_lineno) #输出当前行号 print(traceback.print_exc())#输出报错信息,可追溯到出错行的那种,这句 阅读全文
posted @ 2020-02-24 09:32 mghhz816 阅读(111) 评论(0) 推荐(0) 编辑
摘要: xls文件的读写用xlrd和xlwt模块(见文章里的转载),xlsx文件的读写用openpyxl模块 写xlsx: import openpyxl writebook=openpyxl.load_workbook('test0.xlsx',) #打开已经存在的文件 test=writebook['t 阅读全文
posted @ 2020-02-21 15:54 mghhz816 阅读(624) 评论(0) 推荐(0) 编辑
摘要: 绝对定位 element = driver.find_element_by_xpath('/html/body/div/input[@value="查询"]')[]里是属性,什么属性都可以,是对当前节点的限制条件 相对定位 element = driver.find_element_by_xpath 阅读全文
posted @ 2020-02-16 18:29 mghhz816 阅读(244) 评论(0) 推荐(0) 编辑
摘要: import logging logger = logging.getLogger() logger.setLevel(level = logging.INFO) #可以不设,默认是WARNING级别 handler = logging.FileHandler("log.txt") handler. 阅读全文
posted @ 2020-02-14 15:56 mghhz816 阅读(11544) 评论(0) 推荐(2) 编辑
摘要: 有三种等待方法 1.time.sleep(5) 简单粗暴,强制等待5秒 2.隐式等待 driver.implicityly_wait(10) 在所有执行前,如果没有找到都等待10秒,我试了,不好用,好多都不起作用,为什么不知道 3.显式等待,针对某个元素,找不到之前等待,找到之后立刻执行下一句,查找 阅读全文
posted @ 2020-01-07 17:05 mghhz816 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 第一种方法,不用高级属性,自己硬写一个函数 import pymysql db=pymysql.connect(host="",user="",passwd="",db="",post=3306,charset="utf8"); str="select * from db1 where usrID= 阅读全文
posted @ 2020-01-03 14:27 mghhz816 阅读(1862) 评论(0) 推荐(0) 编辑
摘要: chrome真的是强大的工具 1.在chrome打开的页面点击F12,进入开发者模式 2.点击弹出的开发者工具左上角的跟踪箭头,再点击需要跟踪的页面元素,html程序定位到元素在程序中位置 3.选中的程序语句左侧的三个点 copy copy XPath 阅读全文
posted @ 2019-12-24 16:22 mghhz816 阅读(1194) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 15 下一页