- 微信公众号:未闻Code
- 知识星球:未闻Code
- Blog:https://www.kingname.info
kingname / answer Goto Github PK
View Code? Open in Web Editor NEW未闻 Code 粉丝群问答记录。
License: MIT License
未闻 Code 粉丝群问答记录。
License: MIT License
1.设置加载时间
driver.set_page_load_timeout(时间,秒)
driver = webdriver.Chrome(options=options)
driver.set_page_load_timeout(10)
driver.get(url)
2.减少加载内容
chrome_options.page_load_strategy = 'none'
3.停止页面加载
try:
driver.get(url)
except:
driver.execute_script('window.stop()')
或者
try:
driver.get(url)
except:
driver.execute_script('window.stop() ? window.stop() : document.execCommand("stop");')
4.显隐式等待,因为我没用到,不会写了.
在 XPath 里面,如何匹配部分字符串?
可以使用 contains
关键词
//div/a[contains(text(), "xxx")]
//div/a[contains(@href, "yyy")]
即使指定encoding='utf-8'打开Js文件,在windows运行还是会报编码错。要修改系统库的subporcess.py文件里的 def init 的encoding,将None改为utf-8即可。详情参考:https://www.jianshu.com/p/df0000013254
ua.txt是ua表
user_agent_n = random.randint(1,74)
read_line = linecache.getline('ua.txt',user_agent_n)
chrome_options.add_argument("user-agent={}".format(read_line))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.