python3 安装 pykeyboard 模拟浏览器

By Heanny
2018-12-29
30639 read

先安装pyHook模块 

http://www.lfd.uci.edu/~gohlke/pythonlibs/ 


然后安装 pip install PyUserInput


demo:

from selenium import webdriver
from pymouse import PyMouse
from pykeyboard import PyKeyboard
from pyexcel_xls import get_data
import time,os
from bs4 import BeautifulSoup
def SaveUrlHtml(url):
    try:

        browser.get("https://{}".format(url))
        time.sleep(8)
        m=PyMouse()
        k = PyKeyboard()
        k.press_key(k.control_key)
        k.tap_key('s')
        k.release_key(k.control_key)
        print('ctrl s')
        time.sleep(2)
        m.click(430,58,1)
        time.sleep(1)
        k.type_string('D://{}'.format(url))
        print('write path')
        time.sleep(1)
        k.press_key(k.enter_key)
        time.sleep(3)
        # m.click(366,408,1)
        # time.sleep(0.1)
        # m.click(450,430,1)
        # time.sleep(0.1)
        m.click(410,383,1)
        k.type_string('index.html'.format(url))
        time.sleep(1)
        k.press_key(k.enter_key)
        print('save:',url)
        time.sleep(1)
        k.press_key('y')
        time.sleep(1)
        return
    except Exception as e:
        print( e)
        return



office2019激活
【全】zebra在centos7的安装与使用

Comments

暂无评论,还不快来坐沙发...

Leave a Reply