def reserveButton(): #locate and click reserve a room pg._autoPause(.5, .5) reserve = pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots\serve.png') #pg.center(reserve) pg.moveTo(reserve) pg.click(reserve)
def drag(x, y, button='left', pause=None, _pause=True): """Drag mouse like a human""" pyautogui._failSafeCheck() x, y = pyautogui._unpackXY(x, y) pyautogui.mouseDown(button=button, _pause=False) _humanMoveDrag('drag', x, y, button) pyautogui.mouseUp(button=button, _pause=False) pyautogui._autoPause(pause, _pause)
def arrows_weekend(): pg._autoPause(.5, .5) arrow_list = list( pg.locateAllOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots\mk.png')) pg.moveTo(arrow_list[0]) pg.click(arrow_list[0]) pg.press('enter') pg.moveTo(arrow_list[1]) pg.click(arrow_list[1]) pg.press('down') pg.press('down') pg.press('enter') pg.moveTo(arrow_list[2]) pg.click(arrow_list[2])
def arrows_weekday(): pg._autoPause(.5, .5) arrow_list = list( pg.locateAllOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots\arrow.png') ) pg.moveTo(arrow_list[0]) pg.click(arrow_list[0]) pg.press('enter') pg.moveTo(arrow_list[1]) pg.click(arrow_list[1]) pg.press('down') pg.press('down') pg.press('enter') pg.moveTo(arrow_list[2]) pg.click(arrow_list[2]) start_at_1() pg.moveTo(arrow_list[3]) pg.click(arrow_list[3]) two_hours() click_search()
def rooms(): room_list = [] if pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/22011.png' ): room_list.append('2201') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2203.png'): room_list.append('2203') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2205.png'): room_list.append('2205') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2207.png'): room_list.append('2207') #elif pg.locateOnScreen(r'C:\Users\griff\projects\study-room-script\screenshots/2209.png'): #room_list.append('2209') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2211.png'): room_list.append('2211') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2213.png'): room_list.append('2213') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2215.png'): room_list.append('2215') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2203.png'): room_list.append('2217') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2219.png'): room_list.append('2219') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2221.png'): room_list.append('2221') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2223.png'): room_list.append('2223') elif pg.locateOnScreen( r'C:\Users\griff\projects\study-room-script\screenshots/2225.png'): room_list.append('2225') #add error check here to do it in full window too possibly pg.moveTo(x=40, y=295, pause=1) pg.click() room = room_list[0] print(room) pg.moveTo( r'C:\Users\griff\projects\study-room-script\screenshots/select.png') pg.click() pg._autoPause(.5, .5) pg.moveTo( r'C:\Users\griff\projects\study-room-script\screenshots/confirm.png') pg.click() pg._autoPause(.5, .5) pg.moveTo( r'C:\Users\griff\projects\study-room-script\screenshots/return.png') pg.click()
def move(x, y, pause=None, _pause=True): """Move mouse like a human""" x, y = pyautogui._unpackXY(x, y) pyautogui._failSafeCheck() _humanMoveDrag('move', x, y) pyautogui._autoPause(pause, _pause)
def selfData(dict): xerox.copy(dict['lastname']) pyautogui.doubleClick(400, 307) # set cursor on Familiya pyautogui.hotkey('ctrl', 'v') copyPaste(dict['name']) # type Name copyPaste(dict['surname']) # type surname pyautogui.press('tab') if personalData['gender'] == 'Муж.': pyautogui.press('left') # set male else: pyautogui.press('right') # set female copyPaste(translit(dict['name'], 'ru', reversed=True)) # type latin Name copyPaste(translit(dict['lastname'], 'ru', reversed=True)) # type latin LastName pyautogui.click(318, 505) # set cursor on Резиденство pyautogui.hotkey('home') pyautogui.press('down') pyautogui.press('enter') pyautogui.press('tab') # set date of birthday for i in range(3): pyautogui.typewrite(personalData['age'][i]) ################################## DUL ##################### print('Wait pls:', end=' ') pyautogui.click(190, 890) # click on deactivate button for i in range(15, 0, -1): print(i, end=' ') pyautogui._autoPause(1, 1) print('') pyautogui.click(380, 690) # click on type of dockument pyautogui.press('down') pyautogui.press('enter') pyautogui.press('tab') copyPaste(dict['passport']) # type passport copyPaste('МОСКОВСКИЙ РОВД Г.БРЕСТА') # type who took pyautogui.press('tab') pyautogui.typewrite('05032001') # type date out of document pyautogui.press('tab') pyautogui.typewrite('06032025') # type who took ################################## BirthPlace ##################### pyautogui.press('tab') pyautogui.hotkey('home') pyautogui.press('down') pyautogui.press('enter') for i in range(3): pyautogui.press('tab') copyPaste('БРЕСТ') # type City ################################## REGISTRATION ##################### pyautogui.press('tab') # country # pyautogui.hotkey('home') # pyautogui.press('down') # pyautogui.press('enter') # # print('Wait...5 sec') # pyautogui._autoPause(5, 1) pyautogui.press('tab') pyautogui.typewrite('224002') # type index copyPaste('БРЕСТСКАЯ') # type область copyPaste('ЮЖНЫЙ') # type район pyautogui.press('tab') copyPaste('БРЕСТ') # type City pyautogui.press('tab') copyPaste('МОСКОВСКАЯ') # type street pyautogui.press('tab') pyautogui.typewrite('13') # building pyautogui.press('tab') pyautogui.typewrite('4') # корпус pyautogui.press('tab') pyautogui.typewrite('6') # house ################################## LIVING PLACE ##################### pyautogui.press('tab') pyautogui.press('space') # аналочно месту регистрации pyautogui._autoPause(1, 1) ################################## CONTACT ##################### pyautogui.press('tab') for i in range(5): pyautogui.typewrite(personalData['mobile']) # mobile phone pyautogui.press('tab') copyPaste(personalData['email']) # type street
usernameStr = 'test' passwordStr = 'test' driver = webdriver.Chrome("/Users/alexbrown/Desktop/chromedriver") driver.get(("https://www.fyletikesmaxes.gr/")) driver.find_element_by_name("username").send_keys("test") driver.find_element_by_name("password").send_keys("test") driver.find_element_by_class_name("btn-login").click() time.sleep(random.randint(2, 4)) driver.find_element_by_class_name("world_button_active").click() time.sleep(random.randint(2, 4)) pyautogui.click(x=304, y=198) time.sleep(2) pyautogui.click(x=532, y=706) time.sleep(2) pyautogui.click(x=292, y=731) time.sleep(2) #pyautogui.click(x=453, y=525) #scouts pyautogui.click(x=853, y=570) #light time.sleep(2) pyautogui.click(x=647, y=679) time = driver.find_element_by_id("date_arrival").text while time != "σήμερα στις 17:44:00": time = driver.find_element_by_id("date_arrival").text pyautogui._autoPause(0.3, 1) pyautogui.click(x=453, y=492)