Python:Pyppeteer点击弹出窗口 scrapy框架搭建

import asyncio
import time
import random
from pyppeteer import launch   # 控制模拟浏览器用
from pyppeteer.dialog import Dialog
from retrying import retry      # 设置重试次数用的
js1 = '''() =>{Object.defineProperties(navigator,{webdriver:{get: () => undefined} })}'''
js2 = '''() => {alert ( window.navigator.webdriver )}'''
 
async def main(url): # 定义main协程函数,
    #插件路径
    chrome_extension = r'C:\Users\Administrator.USER-20190313RI\AppData\Local\Chromium\User Data\Default\Extensions\dbclpoekepcmadpkeaelmhiheolhjflj\0.2.7_0'
    args = ['--no-sandbox',
        '--disable-gpu',
        '--log-level=3', #日志等级
        '--disable-infobars',  # 关闭提示
        '--window-size={},{}'.format(1080,950),
        # "--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36",
        '--load-extension={}'.format(chrome_extension), #加载扩展插件
        '--disable-extensions-except={}'.format(chrome_extension),
        ]
    if 

你可能感兴趣的:(python,AI,BlockChain)