上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 22 下一页
摘要: 自动登陆获取cookies: import json import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.edge.service 阅读全文
posted @ 2024-02-21 16:20 wellplayed 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 执行js 前置准备 import time from selenium import webdriver from selenium.webdriver.edge.service import Service ser = Service() ser.path = r'D:\xxx\chromedri 阅读全文
posted @ 2024-02-21 16:18 wellplayed 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 使用场景: 如果我们只需要获取执行后的数据结果,而不需要打开浏览器,就用得上无头浏览器 设置方式: 额外添加以下代码: from selenium.webdriver.chrome.options import Options options = Options() options.add_argu 阅读全文
posted @ 2024-02-21 15:47 wellplayed 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 存在的问题: 我们在find_element找标签时候,标签有可能还没加载出来。而代码执行非常快,这时候取不到标签就会报错,只需加入以下一行代码: bro.implicitly_wait(10) ''' 加了这一句代码,当咱们取标签的时候,如果标签没加载好,最多等待10s,一旦标签加载出来后就会继续 阅读全文
posted @ 2024-02-21 15:42 wellplayed 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 搜索标签 1 By.ID # 根据id号查找标签 bro.find_element(By.ID, 'id内容') 2 By.NAME # 根据name属性查找标签 3 By.TAG_NAME # 根据标签名查找标签 a_list=bro.find_elements(By.TAG_NAME,'a') 阅读全文
posted @ 2024-02-21 15:36 wellplayed 阅读(148) 评论(0) 推荐(0) 编辑
摘要: selenium介绍 selenium本质是通过驱动浏览器,完全模拟浏览器的操作,比如跳转、输入、点击、下拉等,来拿到网页渲染之后的结果,可支持多种浏览器 快速使用 第一步:确认要驱动的浏览器(以谷歌浏览器为例) 第二步:下载与浏览器版本对应的驱动 https://googlechromelabs. 阅读全文
posted @ 2024-02-21 15:16 wellplayed 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 数据准备 html_doc = """ <html><head><title>The Dormouse's story</title></head> <body> <p id="my_p" class="title"><b id="bbb" class="boldest">The Dormouse' 阅读全文
posted @ 2024-02-20 16:35 wellplayed 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 数据准备: # 导入模块 from bs4 import BeautifulSoup # 查询数据文本 html_doc = """ <html><head><title>The Dormouse's story</title></head> <body> <p class="title" id=' 阅读全文
posted @ 2024-02-20 16:30 wellplayed 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 数据准备: # 导入模块 from bs4 import BeautifulSoup # 查询数据文本 html_doc = """ <html><head><title>The Dormouse's story</title></head> <body> <p class="title" id=' 阅读全文
posted @ 2024-02-20 16:09 wellplayed 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 第一步:安装 pip install pymysql 第二步:使用方式 # 导入模块 import pymysql # 建立连接 conn = pymysql.connect( user='root', password="root", host='127.0.0.1', database='car 阅读全文
posted @ 2024-02-20 15:48 wellplayed 阅读(10) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 22 下一页