摘要: Selenium在定位的class含有空格的复合类的解决办法:driver.find_element_by_css_selector("[class='j-inputtext dlemail']").send_keys("yoyo") 阅读全文
posted @ 2018-12-28 09:05 xuejianbest 阅读(1673) 评论(0) 推荐(0) 编辑
摘要: 安装scala运行解释器下载scala,解压,配置SCALA_HOME到解压目录,将$SCALA_HOME/bin加入PATHvim /etc/profileexport SCALA_HOME=/opt/scala-2.11.8export PATH=SCA... 阅读全文
posted @ 2018-12-28 09:05 xuejianbest 阅读(197) 评论(0) 推荐(0) 编辑
摘要: selenium常用操作:from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import W... 阅读全文
posted @ 2018-12-28 09:05 xuejianbest 阅读(1455) 评论(0) 推荐(0) 编辑
摘要: Ubuntu使用chromiumsudo apt-get install -y chromium-browser # 安装浏览器,这部必须,如果只手动安装运行会报错,缺少依赖。或者看这个安装新版浏览器并用binary_location指定位置(需要科学上网)... 阅读全文
posted @ 2018-12-28 09:05 xuejianbest 阅读(2795) 评论(0) 推荐(0) 编辑
摘要: selenium挂ss代理爬取网页内容from selenium import webdriverfrom selenium.webdriver.chrome.options import Optionsfrom selenium.common.except... 阅读全文
posted @ 2018-12-28 09:05 xuejianbest 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 此笔记没有做太多实验,仅做参考,具体情况还要查看文档:https://www.crummy.com/software/BeautifulSoup/bs4/doc.zh/#id4初始化:from bs4 import BeautifulSoup # 从文件获取... 阅读全文
posted @ 2018-12-28 09:05 xuejianbest 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 开始我用BeautifulSoup分析网页时候这样做:#从文件读取html源文件内容with open("html.txt", "r", encoding='utf-8') as file: content = file.read() #替换转义... 阅读全文
posted @ 2018-12-28 09:05 xuejianbest 阅读(436) 评论(0) 推荐(0) 编辑
摘要: 运用css选择器:# -*- coding: utf-8 -*-from lxml import htmlpage_html = ''''''page_tree = html.fromstring(page_html.decode('utf-8'))ele ... 阅读全文
posted @ 2018-12-28 09:05 xuejianbest 阅读(1291) 评论(0) 推荐(0) 编辑
摘要: 向指定url发送get请求:# -*- coding: utf-8 -*-import urllib2url = "http://localhost:80/webtest/test?name=xuejianbest"req = urllib2.Request... 阅读全文
posted @ 2018-12-28 09:04 xuejianbest 阅读(4666) 评论(0) 推荐(0) 编辑
摘要: 原理:变量__EVENTVALIDATION和__VIEWSTATE表示现在页面的状态,其值一般存储在当前页面上。变量__EVENTTARGET会被作为第一个参数传入js方法__doPostBack(eventTarget, eventArgument),表... 阅读全文
posted @ 2018-12-28 09:04 xuejianbest 阅读(2463) 评论(0) 推荐(0) 编辑