- Python Web Scraping Cookbook
- Michael Heydt
- 165字
- 2021-06-30 18:43:59
There's more...
PhantomJS, in many ways, is very similar to Selenium. It has fast and native support for various web standards, with features such as DOM handling, CSS selector, JSON, Canvas, and SVG. It is often used in web testing, page automation, screen capturing, and network monitoring.
There is one key difference between Selenium and PhantomJS: PhantomJS is headless and uses WebKit. As we saw, Selenium opens and automates a browser. This is not very good if we are in a continuous integration or testing environment where the browser is not installed, and where we also don't want thousands of browser windows or tabs being opened. Being headless, makes this faster and more efficient.
The example for PhantomJS is in the 01/05_events_with_phantomjs.py file. There is a single one line change:
driver = webdriver.PhantomJS('phantomjs')
And running the script results in similar output to the Selenium / Firefox example, but without a browser popping up and also it takes less time to complete.
- 連接未來(lái):從古登堡到谷歌的網(wǎng)絡(luò)革命
- 物聯(lián)網(wǎng)網(wǎng)絡(luò)安全及應(yīng)用
- 網(wǎng)絡(luò)創(chuàng)新指數(shù)研究
- 互聯(lián)網(wǎng)安全的40個(gè)智慧洞見:2014年中國(guó)互聯(lián)網(wǎng)安全大會(huì)文集
- 區(qū)塊鏈輕松上手:原理、源碼、搭建與應(yīng)用
- 邁向自智網(wǎng)絡(luò)時(shí)代:IP自動(dòng)駕駛網(wǎng)絡(luò)
- Learning Node.js Development
- Practical Web Penetration Testing
- 一本書讀懂物聯(lián)網(wǎng)
- 云計(jì)算技術(shù)與標(biāo)準(zhǔn)化
- 5G智慧交通
- 算力網(wǎng)絡(luò):云網(wǎng)融合2.0時(shí)代的網(wǎng)絡(luò)架構(gòu)與關(guān)鍵技術(shù)
- Microservices Development Cookbook
- Building Microservices with Spring
- 賽博空間簡(jiǎn)史