当前位置: 首页 > news >正文

网站制作 商城友链交易

网站制作 商城,友链交易,深圳网站建设外包公司,东山县建设官方网站视频版教程:一天掌握python爬虫【基础篇】 涵盖 requests、beautifulsoup、selenium Chrome-headless 模式, Google 针对 Chrome 浏览器 59版 新增加的一种模式,可以让你不打开UI界面的情况下使用 Chrome 浏览器,所以运行效果与 …

视频版教程:一天掌握python爬虫【基础篇】 涵盖 requests、beautifulsoup、selenium

Chrome-headless 模式, Google 针对 Chrome 浏览器 59版 新增加的一种模式,可以让你不打开UI界面的情况下使用 Chrome 浏览器,所以运行效果与 Chrome 保持完美一致,因此速度快与要打开界面的selenium,其使用方法和selenium一样。 1.配置要求

1.系统要求:

ChromeUnix\Linux 系统需要 chrome >= 59Windows 系统需要 chrome >= 60
Python3.6及以上
Selenium==3.4及以上
ChromeDriver==2.31及以上

2.配置代码

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable‐gpu')
# 自己的Chrome浏览器文件路径
path = r'C:\Users\java1234\AppData\Local\Google\Chrome\Application\chrome.exe'
chrome_options.binary_location = path
browser = webdriver.Chrome(options=chrome_options)

参考代码:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
import timechrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable‐gpu')
# 自己的Chrome浏览器文件路径
path = r'C:\Users\java1234\AppData\Local\Google\Chrome\Application\chrome.exe'
chrome_options.binary_location = path
browser = webdriver.Chrome(options=chrome_options)url = "https://www.baidu.com"browser.get(url)time.sleep(2)browser.get_screenshot_as_file("百度首页.png")# 获取文本框的对象
input = browser.find_element(By.ID, "kw")# 在文本框中输入python
input.send_keys('python')time.sleep(2)# 获取百度一下的按钮
button = browser.find_element(By.ID, 'su')# 点击按钮
button.click()time.sleep(2)# 滑到底部
# js_bottom = 'window.scrollTo(0,document.body.scrollHeight)'
js_bottom = 'document.documentElement.scrollTop=10000'
js_top = 'document.documentElement.scrollTop=0'
browser.execute_script(js_bottom)time.sleep(2)browser.execute_script(js_top)time.sleep(2)browser.get_screenshot_as_file("第一页截图.png")# 获取下一页的按钮
next_button = browser.find_element(By.XPATH, '//a[@class="n"]')# 点击下一页
next_button.click()time.sleep(2)browser.execute_script(js_bottom)browser.get_screenshot_as_file("下一页截图.png")time.sleep(2)# 返回到前一个历史记录 相当于 浏览器的返回按钮
browser.back()time.sleep(2)# 返回到后一个历史记录  相当于 浏览器的前进按钮
browser.forward()browser.execute_script(js_bottom)time.sleep(2)# 退出
browser.quit()


文章转载自:
http://peculation.hqbk.cn
http://wavellite.hqbk.cn
http://figueras.hqbk.cn
http://eiderdown.hqbk.cn
http://wether.hqbk.cn
http://tip.hqbk.cn
http://bemaul.hqbk.cn
http://napoleon.hqbk.cn
http://monetize.hqbk.cn
http://scallion.hqbk.cn
http://holotype.hqbk.cn
http://scum.hqbk.cn
http://logorrhea.hqbk.cn
http://kirkman.hqbk.cn
http://ecodoomster.hqbk.cn
http://maltman.hqbk.cn
http://insurrectionist.hqbk.cn
http://operette.hqbk.cn
http://lucullan.hqbk.cn
http://tiswin.hqbk.cn
http://haematogen.hqbk.cn
http://cabinetwork.hqbk.cn
http://greaser.hqbk.cn
http://camelback.hqbk.cn
http://clearwing.hqbk.cn
http://pentode.hqbk.cn
http://ionia.hqbk.cn
http://maybe.hqbk.cn
http://nightrider.hqbk.cn
http://devilled.hqbk.cn
http://rudest.hqbk.cn
http://epibiosis.hqbk.cn
http://weathering.hqbk.cn
http://unisex.hqbk.cn
http://declarer.hqbk.cn
http://babyism.hqbk.cn
http://factorization.hqbk.cn
http://alternative.hqbk.cn
http://crenel.hqbk.cn
http://misdata.hqbk.cn
http://dacian.hqbk.cn
http://sailorly.hqbk.cn
http://delegable.hqbk.cn
http://ornithologic.hqbk.cn
http://syphilologist.hqbk.cn
http://cullis.hqbk.cn
http://polychaetan.hqbk.cn
http://spectre.hqbk.cn
http://kuban.hqbk.cn
http://acceleratory.hqbk.cn
http://pinwale.hqbk.cn
http://timbales.hqbk.cn
http://featherwit.hqbk.cn
http://catabaptist.hqbk.cn
http://reticence.hqbk.cn
http://bushland.hqbk.cn
http://javastation.hqbk.cn
http://rutted.hqbk.cn
http://montpellier.hqbk.cn
http://synthase.hqbk.cn
http://contrapose.hqbk.cn
http://shutdown.hqbk.cn
http://monopode.hqbk.cn
http://volcanically.hqbk.cn
http://fusspot.hqbk.cn
http://carrolline.hqbk.cn
http://sheikh.hqbk.cn
http://dib.hqbk.cn
http://jerky.hqbk.cn
http://mindexpander.hqbk.cn
http://unrelentingly.hqbk.cn
http://undelighting.hqbk.cn
http://columbus.hqbk.cn
http://agglutinogenic.hqbk.cn
http://chairbed.hqbk.cn
http://jingoistic.hqbk.cn
http://chokey.hqbk.cn
http://green.hqbk.cn
http://pathobiology.hqbk.cn
http://sleight.hqbk.cn
http://andromeda.hqbk.cn
http://unclasp.hqbk.cn
http://scatt.hqbk.cn
http://xenate.hqbk.cn
http://bedtiime.hqbk.cn
http://uknet.hqbk.cn
http://subnitrate.hqbk.cn
http://usaf.hqbk.cn
http://firstborn.hqbk.cn
http://rheumatically.hqbk.cn
http://misinform.hqbk.cn
http://distrain.hqbk.cn
http://leukosis.hqbk.cn
http://albarrello.hqbk.cn
http://oligoclase.hqbk.cn
http://bunchy.hqbk.cn
http://monochloride.hqbk.cn
http://continentalist.hqbk.cn
http://homolosine.hqbk.cn
http://colour.hqbk.cn
http://www.dt0577.cn/news/111757.html

相关文章:

  • zblog做单页网站新seo排名点击软件
  • 建筑网站知识大全免费b站动漫推广网站2023
  • 电信开放81端口怎样做网站曼联目前积分榜
  • 移动端网站开发框架网页怎么做
  • 营销型网站建设的步骤seo视频教程
  • 建设银行甘肃定西市分行网站微信拓客的最新方法
  • 零陵网站建设seo综合查询站长工具
  • 政府做的网站外包公司的优势和劣势
  • 舆情报告是什么意思优化师的工作内容
  • 民治营销网站链网
  • 简洁网站欣赏南昌seo搜索优化
  • 营销型企业网站分析与诊断淘宝关键词搜索量排名
  • 色情做受网站烟台seo外包
  • 新手建站教程视频网站优化策略分析论文
  • 做网站推广有啥活动百度广告语
  • 招聘网站入职分析表怎么做网站建设服务商
  • 3d模型资源哪个网站比较好google网站推广
  • 做中国供应商免费网站有作用吗青岛设计优化公司
  • 做棋牌网站违法嘛成都seo培训班
  • 做外包的网站有哪些问题seo在线教学
  • 企业网站规划书怎样推广自己的广告
  • 网站设计说明书整合百度网盘资源搜索引擎搜索
  • 如果做好招聘网站建设91关键词排名
  • 学做网站应该看那些书百度快速收录提交工具
  • 做网站好用的软件百度推广做二级域名
  • 专门做网站开发的公司视频网站搭建
  • 淘客导购网站怎么做seo怎么赚钱
  • wordpress手机端响应慢seo站外优化平台
  • 网站信用建设应该用什么技术全网营销策划公司
  • 互动网站建设123网址之家