随笔分类 - selenium4
摘要:最近研究控制Chrome API来进行自动截图的方法。然后就看到了博客园的文章https://www.cnblogs.com/superhin/archive/2004/01/13/11481910.html 。文章说Selenium并不支持对整个页面截图,原因是Chrome虽然在开发者工具中提供了
阅读全文
摘要:直接上代码: from selenium import webdriver from selenium.webdriver.common.by import By from time import sleep # 定义类 class GetEle: def __init__(self,driver)
阅读全文
摘要:增加全局的超时 和 等待时间: import time from selenium.webdriver import Keys, ActionChains from selenium.webdriver.common.by import By from selenium import webdriv
阅读全文
摘要:场景: 点击一个按钮,然后弹出对话框,从本地选择需要上传的文件,自动关闭对话框。 最后在点击web页面的ok按钮 提交上传文件。 ps:因为这里是按钮上传,所以用input框的sendkeys方法是无法上传成功的了。 下面是点击按钮上传成功的案例,需要注意的是,上传时,还需要了解各个按键是什么tex
阅读全文
摘要:参考: https://blog.csdn.net/qq_45664055/article/details/132371769 # Enable selenium download function chrome_options = webdriver.ChromeOptions()#Use chr
阅读全文
摘要:selenium是没有办法直接获取请求的详细Headers,很多时候我们我们是需要提取相关的参数来做进一步使用比如token之类的 这里推荐使用一个SeleniumWire模块来达到目的 Selenium-wire模块: 安装: pip install selenium-wire Selenium
阅读全文
摘要:前言 selenium的webdriver本身没有api能做这个事情,详见issue。 国内的博客全抄来抄去,说selenium直接加add_argument参数就好了,弄得找了好几天找代码问题,上外网查秒解决。所以要学好计算机还是得英文呐~~ 我用requests登录后,获取到了认证信息,但是接下
阅读全文
摘要:1.驱动安装 1.1自动安装(适用于 外网可以访问的场景) import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.
阅读全文