コード例 #1
0
    def __init__(self, username, pw):
        # self.driver = webdriver.Chrome(PATH, options=chrome_options)
        self.driver = webdriver.Chrome(options=chrome_options)
        self.username = username
        self.driver.get("https://instagram.com")
        sleep(2)

        screenWidth, screenHeight = pyautogui.size(
        )  # Get the size of the primary monitor.

        currentMouseX, currentMouseY = pyautogui.position(
        )  # Get the XY position of the mouse.
        pyautogui.displayMousePosition()

        # pyautogui.write("/Users/Hai/github/python/Instagram/images/0.png")
        # pyautogui.press('enter')

        sleep(2)
        self.driver.find_element_by_xpath(
            "//button[contains(text(), 'Next')]").click()
        sleep(4)
        self.driver.find_element_by_xpath("//textarea[@autocomplete=\"off\"]")\
            .send_keys("Am i not a cute m**********r? #Pro #Sexy #Followme")
        self.driver.find_element_by_xpath(
            "//button[contains(text(), 'Teilen')]").click()
        sleep(2)
        print("success")
コード例 #2
0
### pyautogui.dragTo(arg1, arg2) - Will single click and hold as the cursor moves to the given co-ordinates. Add arg3 for duration. ###
### pyautogui.dragRel(arg1, arg2) - Will single click and hold as the cursor moves from its current position relative to the arguments given, arg3 is optional for duration. ###
### e.g pyautogui.dragRel(-100, 200, 3) - Moves the cursor left 100 pixels and down 200 pixels over 3 seconds. ### 
pyautogui.click(160, 507) # Instantly moves the cursor to the given co-ordinates and performs a single mouse click.
### To perform a single click in the cursor's current location, do not provide any arguments. ###

pyautogui.doubleClick(1372, 280) # Instantly moves the cursor to the co-ordinates provided and double clicks (which opens the C# folder on my desktop).
### .rightClick(arg1, arg2) is also an option. ###
### .middleClick(arg1, arg2) does not appear to work on Macs. ###
### Providing no arguments uses the cursor's current location.  ###

###################################################################
###                        * IMPORTANT *                        ###
###                                                             ###
###    If you ever lose control of the cursor while running     ###
###     pyautogui, slam the mouse into the top left corner      ###
###                                                             ###
###              THIS FAIL-SAFE STOPS THE PROGRAM.              ###
###                                                             ###
###################################################################

# If you run the following in terminal, you can quickly and easily find the desired co-ordinates of objects to write a script.
### Remember to start Python in the terminal first. ###
import pyautogui
pyautogui.displayMousePosition() # This will return the X co-ordinates, Y co-ordinates and the RGB details of the current pixel the cursor is on.
# e.g "X: 489 Y: 177 RGB:(0, 160, 0) - While the cursor is hovering over a green pixel.
# Press Ctrl + C to Quit.
### ONLY RUN THIS IN TERMINAL, NOT IDLE. ###

### Further reading at https://pyautogui.readthedocs.org ###
コード例 #3
0
ファイル: pygui.py プロジェクト: benitez96/automation
#Module --> pip install pyautogui

# To stop a bug program move mouse cursor to top-left corner.
import pyautogui

# ========MOUSE METHODS===========

pyautogui.size()  #returns monitor pixels
width, height = pyautogui.size()
pyautogui.position()  # returns mouse's current position
pyautogui.moveTo(550, 266, duration=1.5)  # moves mouse
pyautogui.moveRel(200, -200, duration=1)
pyautogui.click(484, 16)  # Clicks on pixel
pyautogui.dragRel(200, 200, duration=1.2)  #drags pointer

pyautogui.displayMousePosition(
)  #shows current position in live -> must be run on console

#==========KEYBOARD METHODS===============

pyautogui.typewrite('Hello world!!', interval=0.5)
#makes click and write keys from the list
pyautogui.click(375, 501)
pyautogui.typewrite(['a', 'b', 'left', 'left', 'X', 'Y'], interval=0.5)
# to seeing every key
pyautogui.KEYBOARD_KEYS
# to hotkeys
pyautogui.hotkey('ctrl', 'o')

#========SCREENSHOTS & IMAGE RECOGNITION==============

pyautogui.screenshot('screenshot.png')
コード例 #4
0
''' live-prints xy-coord of mouse to console '''

import pyautogui as pag

pag.displayMousePosition()
コード例 #5
0
import pyautogui
pyautogui.size() # to get the dimensions of the screen
width,height = pyautogui.size() # store height and width in respective variables
pyautogui.position() # returns the current mouse pointer locaton
pyautogui.moveTo(10,10,duration = 1.5)# move the pointer to the provided coordinates
pyautogui.moveRel(200,0,duration = 1.5)# move the pointer to the provided coordinates( in pixels)
pyautogui.click(339,38) # click on a specific coordinate
pyautogui.doubleClick()
pyautogui.middleClick()
pyautogui.rightClick()
pyautogui.dragTo(10,10,duration = 1.5)# drag the pointer to the provided coordinates

pyautogui.displayMousePosition() #real time mouse pointer location 
コード例 #6
0
from pyautogui import *  # Importiere Libraries die man braucht
import pyautogui
import time
import keyboard
import numpy as np
import random
import win32api, win32con

time.sleep(2)  # 2 Sekunden Delay, damit man in das Game tabben kann

pyautogui.displayMousePosition()  # Display Mouse Position in Console
コード例 #7
0
ファイル: DetectarColores.py プロジェクト: Tavo826/OpenCV
import pyautogui as py

py.displayMousePosition()
コード例 #8
0
def intiate_rgb_color():
    pyautogui.displayMousePosition()
コード例 #9
0
import pyautogui  # install pyautogui

width, height = pyautogui.size()  # returns screen res

pyautogui.position()  # returns mouse position

pyautogui.moveTo(10, 10)
pyautogui.moveTo(10, 10, duration=1.5)  # drags mouse to position

pyautogui.moveRel(200, 0)  # move 200 pixels to the right
pyautogui.moveRel(
    0, -100)  # move mouse up 100 pixels relative top current position

pyautogui.click(339, 38)  # click this position
pyautogui.doubleClick()  # double click at current position

pyautogui.dragRel(300, 0)  # drags mouse from current postion

pyautogui.displayMousePosition(
)  # only works in terminal, tells you your mouse coordinates while you drag
コード例 #10
0
def getmousepos():
    pyautogui.displayMousePosition()
コード例 #11
0
ファイル: coord_picker.py プロジェクト: JasonRHemann/PokerBot
def cordPicker():
    pyautogui.displayMousePosition()
コード例 #12
0
# Size of screen
# width, height = pyautogui.size()

# Position of the mouse
print(pyautogui.position())

# Controlling the mouse
# pyautogui.moveTo(1325,419)

# Controlling the mouse slowly (1.5 seconds)
# pyautogui.moveTo(1325,419, duration=1.5)

# Controlling/moving mouse to a relative position
# pyautogui.moveRel(200, 0)       # 200 pixels to the right.

# Controlling/moving mouse to a relative position with time
# pyautogui.moveRel(200, 0, 2)       # 200 pixels to the right in 2 seconds.
# pyautogui.moveRel(0, -100, 2)       # 100 pixels up in 2 seconds.

# Clicking the mouse
# width, height = pyautogui.position()    # Find position of where you want to click.
# pyautogui.click(width, height)
# pyautogui.doubleClick(width, height)    # Double click something. You can also rightClick and middleClick.

# deagTo() and dragRel() will click the mouse while moving it.

# Displays the mouse position.
pyautogui.displayMousePosition(
)  # Real time postion and rgb value of what the mouse is touching.
コード例 #13
0
# -*- coding: utf-8 -*-
"""
Created on Tue Nov  5 11:56:42 2019

@author: PranavM
"""
import pyautogui
width, height = pyautogui.size()

"Controlling the Mouse"
pyautogui.position()
pyautogui.moveTo(10, 10)
pyautogui.moveTo(10, 10, duration=5)
pyautogui.moveRel(500, 0)  #moves the mouse relative to the current position

pyautogui.displayMousePosition(
)  # to check the position of the mouse at the moment. However, it is better to use it in CMD

"Controlling the Keeyboard"
pyautogui.click()
pyautogui.typewrite(('Hello World'))

from tkinter import *

root = Tk()

topframe = frame(root)
topframe.pack()

bottomframe = frame(root)
bottomframe.pack(side=BOTTOM)
コード例 #14
0
import pyautogui as pi

pi.displayMousePosition()
コード例 #15
0
 def get_mouse_position(self):
     pyautogui.displayMousePosition()
コード例 #16
0
ファイル: __init__.py プロジェクト: LoLei/pycolorpicker
def preview_color():
    pyautogui.displayMousePosition()
コード例 #17
0
from pyautogui import displayMousePosition

displayMousePosition(0, 0)
コード例 #18
0
def main():
    pyautogui.displayMousePosition()
コード例 #19
0
#!/usr/bin/env python3

import pyautogui

width, height = pyautogui.size()  # screen resolution
print(width, height)  # 1440 900
pyautogui.position()  # x,y coordinates
pyautogui.displayMousePosition(
)  # real-time mouse coordinates (572 Y:  809 RGB: (NaN, NaN, NaN))

pyautogui.moveTo(10, 10,
                 duration=1.5)  # absolutely move to top-left in 1.5 seconds
pyautogui.moveRel(
    200, 0, duration=1.5)  # relatively move 200 pixels to the right in 1.5s
pyautogui.moveRel(0, -100, duration=1)  # move 100 pixels up

pyautogui.click()  # click current cursor location
pyautogui.click(339, 38)  # click at x,y
pyautogui.doubleClick(339, 38)
コード例 #20
0
""" get mouse position using this code"""

import pyautogui
from time import sleep

while True:
    print(pyautogui.displayMousePosition(), "\n")
    sleep(1)
コード例 #21
0
# move cursor relative to current position of mouse
pyautogui.moveRel(20, 0)

# it also has a duration to it
pyautogui.moveRel(200, 0, duration=2)

# to move up, the y coordinates are -ve going up
pyautogui.moveRel(0, -100)
# also pass the duration if you want
pyautogui.moveRel(0, -100, duration=1)

# clicking on the help in vs code
# s1. Find the location where the mouse is placed
print(pyautogui.position())
# s2. use the click and make it click on the place you want(here on the help toolbar),
# if no arguments are passed, it clicks wherever the osition is immediately
pyautogui.click(480, 21)

# to double click use
pyautogui.doubleClick(480, 21)
# right click
pyautogui.rightClick(480, 21)
# middle button click
pyautogui.middleClick(480, 21)

# to figure out coordinates for every part that you might click on in the screen
# easier way is from terminal, and write the below two lines
import pyautogui
pyautogui.displayMousePosition(
)  # shows the real time position of the mouse and the rgb values of pixel of the place your cursor is on
コード例 #22
0
#Move mouse
pyautogui.moveTo(10, 10)

#Move mouse
pyautogui.moveTo(10, 10, duration=1.5)

#More relative
pyautogui.moveRel(200, 0, duration=1.5)

#Click
pyautogui.click(275, 34)
pyautogui.rightClick(275, 34)

#See coordinates in real time (run in Ipython)
pyautogui.displayMousePosition()

#test

#Write text (interval time between caracters)
pyautogui.click(137, 159)
pyautogui.typewrite("Hello world!", interval=0.2)
pyautogui.typewrite(['a', 'b', 'c'], interval=0.2)
pyautogui.hotkey('ctrl', 'o')

#Screenshots
pyautogui.screenshot("screenshot_example.png")
pyautogui.locateOnScreen("calc.png")
pyautogui.locateCenterOnScreen("calc.png")
pyautogui.moveTo(1105, 433)
pyautogui.moveTo(pyautogui.locateCenterOnScreen("calc.png"))
コード例 #23
0
ファイル: core.py プロジェクト: mwobensmith/proto
def get_screen():
    if DEBUG is True:
        pyautogui.displayMousePosition()
    return _region_grabber(coordinates=(0, 0, screenWidth, screenHeight))