随笔分类 -  爬虫 / Selenium

摘要:有些网站时一直滚动就会加载新数据的,在selenium中解决方法: ```Python def loaddata_by_scroll(self, driver): js = 'return document.body.scrollHeight;' # 获取当前高度 check_height = dr 阅读全文
posted @ 2023-07-17 11:30 运维爱背锅 阅读(265) 评论(0) 推荐(0) 编辑
摘要:```Python """ P.S:需要接管现有浏览器 ** 使用步骤: 1、打开浏览器,设置好远程调试端口,并扫描登录淘宝。 chrome.exe --remote-debugging-port=9333 --user-data-dir="G:\spider_taobao"** 2、运行程序,自动 阅读全文
posted @ 2023-07-17 11:29 运维爱背锅 阅读(604) 评论(0) 推荐(0) 编辑
摘要:[https://www.selenium.dev/documentation/webdriver/waits/](https://www.selenium.dev/documentation/webdriver/waits/) 有时候我们需要等待网页上的元素出现后才能操作。selenium中可以使 阅读全文
posted @ 2023-07-17 11:28 运维爱背锅 阅读(176) 评论(0) 推荐(0) 编辑
摘要:无头模式适合的场景: - 部署到没有gui界面的服务器,比如linux - 开发环境测试完全没问题后可以使用无头模式,提高selenium速度。 ```YAML # 使用headless无界面浏览器模式 chrome_options.add_argument('--headless') chrome 阅读全文
posted @ 2023-07-17 11:28 运维爱背锅 阅读(430) 评论(1) 推荐(0) 编辑
摘要:```Python import random import time from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.chrome.service 阅读全文
posted @ 2023-07-17 11:27 运维爱背锅 阅读(57) 评论(0) 推荐(0) 编辑
摘要:[https://www.selenium.dev/documentation/webdriver/actions_api/](https://www.selenium.dev/documentation/webdriver/actions_api/) 注意:对于滚轮的操作,只支持chrome浏览器 阅读全文
posted @ 2023-07-17 11:26 运维爱背锅 阅读(68) 评论(0) 推荐(0) 编辑
摘要:[https://www.selenium.dev/documentation/webdriver/elements/file_upload/](https://www.selenium.dev/documentation/webdriver/elements/file_upload/) 用的方法就 阅读全文
posted @ 2023-07-17 11:26 运维爱背锅 阅读(12) 评论(0) 推荐(0) 编辑
摘要:# 查找元素 官方文档:[https://www.selenium.dev/documentation/webdriver/elements/locators/](https://www.selenium.dev/documentation/webdriver/elements/locators/) 阅读全文
posted @ 2023-07-17 11:24 运维爱背锅 阅读(419) 评论(0) 推荐(0) 编辑
摘要:# 浏览器属性 > 在使用selenium过程中,实例化driver对象后,driver对象有一些常用的属性和方法 1. `driver.page_source` 当前标签页浏览器渲染之后的网页源代码。 2. `driver.current_url` 当前标签页的url。 3. `dirver.ti 阅读全文
posted @ 2023-07-17 11:24 运维爱背锅 阅读(36) 评论(0) 推荐(0) 编辑
摘要:```Python import time from selenium import webdriver from selenium.webdriver.chrome.service import Service as ChromeService # 驱动文件所在路径 DIRVER_PATH = r 阅读全文
posted @ 2023-07-17 11:15 运维爱背锅 阅读(341) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
🚀
回顶
收起
  1. 1 404 not found REOL
404 not found - REOL
00:00 / 00:00
An audio error has occurred.