• 滑动


    from selenium.webdriver import ActionChains
    from pynput.keyboard import Key, Controller as c2
    from pynput.mouse import Button, Controller as c1
    from selenium import webdriver
    import time

    key=c2()
    mouse = c1()

    options = webdriver.ChromeOptions()
    options.add_experimental_option('excludeSwitches', ['enable-automation'])#开发者模式,
    driver = webdriver.Chrome(executable_path=r'D:爬虫相关资料驱动程序chromedriver_win32chromedriver.exe',chrome_options=options)
    driver.maximize_window()
    js = 'window.open("https://magi.com");'
    driver.execute_script(js)
    windows = driver.window_handles
    driver.switch_to.window(windows[-1])
    time.sleep(2)
    mouse.position = (500, 320)
    mouse.press(Button.left)
    mouse.release(Button.left)
    time.sleep(1)
    key.type('金融')
    time.sleep(0.5)
    mouse.position = (720, 110)
    mouse.press(Button.left)
    mouse.release(Button.left)
    time.sleep(5)

    mouse.position = (890, 330)
    mouse.press(Button.left)
    mouse.move(1150, 330)
    mouse.release(Button.left)
    time.sleep(5)
    cookies_dic={}
    for coo in driver.get_cookies():
    cookies_dic[coo["name"]] = coo["value"]
    print(cookies_dic)
    driver.quit()
  • 相关阅读:
    求最大的矩形(悬线法)
    限制不互素对的排列(构造)
    括号(构造)
    G. 4.奶牛(二进制枚举)
    新飞行棋(上楼梯)
    小天狼星的访问
    欧拉筛线性筛法,约数和和约数个数
    Find The Multiple
    How Many O's? UVA
    GCD LCM UVA
  • 原文地址:https://www.cnblogs.com/duanhaoxin/p/12029767.html
Copyright © 2020-2023  润新知