当前位置:网站首页>使用webdriver时不显示浏览器运行
使用webdriver时不显示浏览器运行
2022-06-10 02:53:00 【盼丨盼】
使用webdriver进行爬虫、自动化操作时不显示浏览器运行。
# -*- coding:utf-8 -*-
"""
project: test_test
file: m3u8
author: WangPanPan
create date: 2022/5/30 19:31
"""
from selenium.webdriver.chrome.options import Options
import requests
from selenium import webdriver
from selenium.webdriver.common.by import By
#参考的网页
base_url = 'https://jingyan.baidu.com/article/00a07f38500e2bc3d028dcd3.html'
# 使用webdriver
options = Options()
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
driver.get(base_url)
three = driver.find_element(By.XPATH,'//*[@id="format-exp"]/div[3]/div/ol/li[3]/div[2]/p').text
print(three)
driver.quit()边栏推荐
- Numpy矩阵操作
- ESP32 内部函数/变量无法跳转到定义
- command
- golang微服务实例Protobuf和Grpc的使用
- Three ways to realize application communication in Qiankun (props, initglobalstate, socket.io)
- 复杂模型机实验
- 51 Introduction au micro - ordinateur à puce unique - - communication infrarouge
- ModuleNotFoundError: No module named ‘pip‘
- College entrance examination [activities]
- 2022.6.9 C asynchronous
猜你喜欢

微信小程序 音乐播放代码(播放方式,歌词滚动)

Using GDI to realize multi-channel video stream merging
MySQL 8.0.29 installation and configuration method graphic tutorial (Windows zip version)

微电网数字孪生 | 智能时代,部署源网荷储一体化管控平台

Ones Fengbin: from engineer to CTO, with uncertainty and incomplete information | ones talk

DataFrame日期数据处理

^27 timer related problems

Opengauss "user story" is officially launched! One click to share practical experience, Limited Edition Gift waiting for you
![Chapter VI semiconductor memory [microcomputer principle]](/img/fa/0bf833def1e6ea8b77937f4685ecf5.png)
Chapter VI semiconductor memory [microcomputer principle]

^28js is single threaded
随机推荐
Double pointer | 844 Compare strings with backspace
Numpy矩阵操作
Le premier élément de la Sous - collection est inséré par un autre tableau
修改谷歌浏览器Google Chrome缓存位置
2022.6.9 C asynchronous
微信小程序 音乐播放代码(播放方式,歌词滚动)
大家用什么工具或平台来做接口性能测试
qiankun 内实现应用通讯的三种方式(props、initGlobalState、socket.io)
22.对于BFS的思考
After the SSL certificate is installed, the website still shows insecurity
ModuleNotFoundError: No module named ‘pip‘
Timestamp transform to standard time format
The first element in a subset is inserted by another array
二分法 | 35. 搜索插入位置
电源管理(STM32)
Postgresql中如何终止正在执行的查询
SQL Server SQL statement create index
Cat dog classification based on tensorflow
Complex model machine experiment
flutter 双端扫码下载app