pycharm配置python3.8版本专门用于undecteded_chromedriver测试

pycharm配置python3.8版本专门用于undecteded_chromedriver测试

作者:虚坏叔叔

博客:https://pay.xuhss.com

早餐店不会开到晚上,想吃的人早就来了!😄

一、Pycharm及python环境的配置

1.安装python-3.8.7rc1-amd64.exe

2.pycharm添加python解释器

3.配置脚本启动

创建一个脚本MakeBaiDuShuRuKuang.py

python 复制代码
# -*- coding: utf-8 -*-
import undetected_chromedriver as uc
'''


'''
class JobTask():
    def __init__(self):

        self.source = "BaiduShuRuKuang"
        self.deep = 1 #定义递归的深度 控制相关性
        self.url = {
            "num" : 1,
        }


    '''

    '''
    def run(self,params):
        act = params['act']

        driver = uc.Chrome(headless=True,use_subprocess=False)
        driver.get('https://nowsecure.nl')
        driver.save_screenshot('nowsecure.png')

# 当程序直接运行时,执行main函数
if __name__ == "__main__":
    # 创建 JobTask 类的实例
    job_task = JobTask()

    # 定义包含 'act' 键的参数字典
    params = {'act': 'your_action_here'}

    # 调用 run 函数并传递参数
    job_task.run(params)

配置脚本的调试启动方式:

如果引用相对目录建议放到外层

二、undetected-chromedriver安装库

复制代码
pip install undetected-chromedriver

三、Undetected Chromedriver, AttributeError: 'ChromeOptions' object has no attribute 'headless'

如果报上面的错误,需要降级selenium到4.12.0版本

相关推荐
xoliu12 分钟前
Pytorch核心基础入门
人工智能·pytorch·python
一瞬祈望6 分钟前
ResNet50 图像分类完整实战(Notebook Demo + 训练代码)
人工智能·python·神经网络·数据挖掘
其美杰布-富贵-李8 分钟前
PyTorch Lightning Callback 指南
人工智能·pytorch·python·回调函数·callback
_codemonster19 分钟前
python易混淆知识点(十六)lambda表达式
开发语言·python
superman超哥1 小时前
仓颉Option类型的空安全处理深度解析
c语言·开发语言·c++·python·仓颉
2401_841495641 小时前
【LeetCode刷题】跳跃游戏Ⅱ
数据结构·python·算法·leetcode·数组·贪心策略·跳跃游戏
Data_agent1 小时前
OOPBUY模式淘宝1688代购系统搭建指南
开发语言·爬虫·python
张哈大1 小时前
AI Ping 上新限免:GLM-4.7 与 MiniMax-M2.1 实测对比
人工智能·python
乘凉~1 小时前
【Linux作业】Limux下的python多线程爬虫程序设计
linux·爬虫·python
wanzhong23331 小时前
解决vscode在win下使用cuda无法跳转库函数的问题
ide·vscode·编辑器·cuda·高性能计算