def download_stay_picinfo(): #Downloads picture locally as jpg img, MIGHT be useful if we are doing local image classification....but I rather gcloud classify with url if needed print('Extracting Top 5 Stay Information..') url=[] url=get_stay_url() print('Downloading Pics uploaded by host..') i=0 k=0 while (i<5): r.url(url[i+k]) r.click('//*[@id="FMP-target"]') j=0 while (1): j=j+1 print(f'Downloading Homestay {i+1} Photo {j}') r.wait(0.4) #r.snap('//div[@data-testid="photo-viewer-slideshow-desktop"]/div/div/div/div/div/img',f"data/{i+1}/{j}.jpg") #fastest but not perfect if (r.exist('//div[@data-testid="photo-viewer-slideshow-desktop"]/div/div/div/div/div/img/@src') == True): dl_link=r.read('//div[@data-testid="photo-viewer-slideshow-desktop"]/div/div/div/div/div/img/@src') r.download(dl_link,f'data/{i+1}/{j}.jpg') print(f'Homestay {i+1} Photo {j} downloaded!') else: i=i-1 #Detects Whales (Airbnb Plus spoils the format alot) k=k+1 #Compensating Constant k print("WHALE detected, adding one more loop..") if (r.exist('/html/body/div[9]/div/div/div/div/div[3]/div/div[2]/button') == False or j >= 15): break #Max 15 photos r.click('/html/body/div[9]/div/div/div/div/div[3]/div/div[2]/button') i=i+1 r.click('/html/body/div[9]/div/div/div/section/div/div[1]/div/button') print('Done.')
def get_rpa(timeout=10): r.init() r.url('https://www.google.com') r.type('//*[@name="q"]', 'decentralization[enter]') print(r.read('result-stats')) r.snap('page', 'results.png') r.close()
def initialize(): print('Initializing...') r.init() r.url(URL) if r.exist('//*/button[@type="submit"]') == True: r.click('//*/button[@type="submit"]') # Anti RPA by AirBnB print('Done.')
def main(): r.init() r.url('https://www.hattrick.org/zh/') r.type('ctl00_CPContent_ucLogin_txtUserName', 'ccforever') r.type('ctl00_CPContent_ucLogin_txtPassword', 'cc0323') r.click('ctl00_CPContent_ucLogin_butLogin') r.wait('10') r.click('myClubLink')
def today_dollar(): r.init() r.url('https://www.melhorcambio.com/dolar-hoje') sleep(4) dolar = r.read('//*[@id="comercial"]') sleep(2) print(f'{dolar} | {datetime.today()}') r.close() return dolar
def acoe(): r.init(visual_automation=True) r.url("https://acoe.annauniv.edu/rusa/login/student") # rollNo = r.ask("enter roll number") r.type("input", "2018103549") r.type("password", "Amiami@143[enter]") r.dclick("login")
def initialize(): print('Initializing...') r.init() r.timeout(15) #set timeout to wait longer r.url(URL) while r.exist('//*/button[@type="submit"]') == False: r.url(URL) print("Wrong page detected, retrying..") r.click('//*/button[@type="submit"]') # Anti RPA by AirBnB print('Done.')
def faceBook(): r.init(visual_automation=True) r.url("https://www.facebook.com") r.dclick("email") userName = r.ask("Enter the User Name") r.type("email", userName) password = r.ask("Enter the password") r.type("pass", password + "[enter]")
def dollar_cannadian(): r.init() r.url('https://www.melhorcambio.com/dolar-hoje') sleep(4) r.click('//*[@id="dock"]/ul/li[2]/a') sleep(4) dolar_c = r.read('//*[@id="comercial"]') sleep(2) print(f'{dolar_c} | {datetime.today()}') r.close() return dolar_c
def hackerrank(): r.init(visual_automation=True) r.url("https://www.hackerrank.com/dashboard") r.dclick(".login.pull-right.btn.btn-dark.btn-default.mmT") r.dclick("input-1") userName = r.ask("Enter the User Name") r.type("input-1", userName) password = r.ask("Enter the password") r.type("input-2", password + "[enter]")
def do_web_auto(search_data): r.init() r.url('https://www.google.com') r.click('.gLFyf.gsfi') r.type('.gLFyf.gsfi', f'{search_data}[enter]') #r.type("//*[@name='q']', 'decentralization[enter]") #print(r.read('result-stats')) r.snap('page', 'results.png') res = r.read('result-stats') r.close() return res
def carrefuorRegisterRpa(cnpj, customerFirstName, customerLastName, displayName, companyName, registrationMunicipal, registrationState, category, platform, loginEmail, phone): url = 'https://www.carrefour.com.br/marketplace/inscreva-se' r.init() r.url(url) time.sleep(10) r.click('//*[@id="onetrust-accept-btn-handler"]') time.sleep(3) r.click('//*[@id="00N6g00000RpFD9"]') r.click('//*[@id="00N6g00000RpFD9"]')
def convert_html_to_jpg(): URL = "http://127.0.0.1:5000/get_html" #localhost r.init() r.url(URL) print('Zooming out') r.click('//*[@class="leaflet-control-zoom-out"]') r.click('//*[@class="leaflet-control-zoom-out"]') print('Waiting to load...') r.wait(18) print('Snapping') r.snap('//html/body', "./Images/map.jpg") print('Done.') r.close()
def login_to_admin(admin_url, username, password): r.url(admin_url) element = '//input[@id="id_username"]' if r.exist(element): print('Login') r.click(element) r.type(element, username) element = '//input[@id="id_password"]' r.click(element) r.type(element, password) #print(element, password) element = '//input[@type="submit"]' r.click(element) else: print('Already logged in')
def gestionar_uuii(uuii, codigoPostal, cto): r.url(uuii) r.timeout(120) if r.read('//*[@id="btnNew"]'): r.click('//*[@id="btnNew"]') r.timeout(120) if r.read('//*[@id="btnFormEditSave"]'): r.select('//*[@name="planta"]', 'BA') r.type('//*[@name="cp"]', codigoPostal) r.click('//*[@id="btnFormEditSave"]') if r.read('//*[@class="tableCell"]'): r.click('//*[@class="tableCell"]') r.click('//*[@id="btnRD"]') if r.read('//*[@id="btnFormRDSave"]'): r.timeout(120) r.select('//*[@name="rd"]', cto) r.wait(5) if r.read('//*[@id="ctoAddress_ctoName"]'): r.click('//*[@id="btnFormRDSave"]') if r.url('xxxx.do?dispatchMethod=rdSave'): print('Gestionada')
# Sample script to search on Yahoo, take screenshot of results and visit DuckDuckgo # RPA for Python's simple and powerful API makes robotic process automation fun! # pip install rpa to install, pip install rpa --upgrade to get latest version # to use in Jupyter notebook, Python script or interactive shell import rpa as r # use init() to start TagUI, it auto downloads TagUI on first run # default init(visual_automation = False, chrome_browser = True) r.init() # use url('your_url') to go to web page, url() returns current URL r.url('https://ca.yahoo.com') # use type() to enter text into an UI element or x, y location # '[enter]' = enter key, '[clear]' = clear field r.type('ybar-sbq', 'github') # use read() to fetch and return text from UI element search_text = r.read('ybar-sbq') print(search_text) # use click() to click on an UI element or x, y location # rclick() = right-click, dclick() = double-click r.click('ybar-search') # use wait() to wait for a number of seconds # default wait() is 5 seconds r.wait(6.6)
r.click('//*[@class="tableCell"]') r.click('//*[@id="btnRD"]') if r.read('//*[@id="btnFormRDSave"]'): r.timeout(120) r.select('//*[@name="rd"]', cto) r.wait(5) if r.read('//*[@id="ctoAddress_ctoName"]'): r.click('//*[@id="btnFormRDSave"]') if r.url('xxxx.do?dispatchMethod=rdSave'): print('Gestionada') # Start the program r.init() # Open the website r.url('http://xxxxxt/login.jsp') # Log in if you are not log in if r.url() == 'http://fxxxxxx/login.jsp': user = input("Introduce el usuario de FDTT: ") password = input("Introduce el password: "******"user"]', user) r.type('//*[@name="password"]', password + '[enter]') # path to the file with the information file = input("Introduce la ruta del archivo de fincas: ") # iteration of rows in file with open(file, 'rt') as f: data = csv.reader(f) for row in data: ui = row[0] cp = row[1] cto = row[2]
def extract_stay_info_as_data( ): #Generates URL/text in dict instead, shorten time for upload/download, more unified data = { "0": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "" }, "1": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "" }, "2": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "" }, "3": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "" }, "4": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "" } } print('Extracting Top 5 Stay Picture Information (10 Image Max)..') url = [] url = get_stay_url() i = 0 k = 0 while (i < 5): data[str(i)]["url"] = url[i + k] r.url(url[i + k]) print(f'Extracting Text Data - Homestay {i+1}') if (r.exist( '//*[@data-plugin-in-point-id="TITLE_DEFAULT"]/div/div/section/div/div/h1' ) == True): data[str(i)]["name"] = r.read( '//*[@data-plugin-in-point-id="TITLE_DEFAULT"]/div/div/section/div/div/h1' ) data[str(i)]["description"] = r.read( '//*[@data-plugin-in-point-id="OVERVIEW_DEFAULT"]/div/div/div/section/div/div/div/div/div' ) data[str(i)]["description"] = data[str(i)]["description"].replace( "\xa0", " ") data[str(i)]["inventory"] = r.read( '//*[@data-plugin-in-point-id="OVERVIEW_DEFAULT"]/div/div/div/section/div/div/div/div/div[2]' ) data[str(i)]["price"] = r.read( '//*[@data-plugin-in-point-id="BOOK_IT_SIDEBAR"]/div/div[2]/div/ul[2]/li/span[2]' ) #Total Price if r.present( '//*[@data-plugin-in-point-id="REVIEWS_DEFAULT"]/div/div/section/div/div/div/h2/span[2]/span' ): data[str(i)]["rating"] = r.read( '//*[@data-plugin-in-point-id="REVIEWS_DEFAULT"]/div/div/section/div/div/div/h2/span[2]/span' ) else: data[str(i)]["rating"] = "No Reviews Yet" r.click('//*[@id="FMP-target"]') j = 0 while (1): j = j + 1 print(f'Extracting Picture Data - Homestay {i+1} Photo {j}') r.wait(0.4) #r.snap('//div[@data-testid="photo-viewer-slideshow-desktop"]/div/div/div/div/div/img',f"data/{i+1}/{j}.jpg") #fastest but not perfect if (r.exist( '//div[@data-testid="photo-viewer-slideshow-desktop"]/div/div/div/div/div/img/@src' ) == True): data[str(i)]["picurl"][j - 1] = r.read( '//div[@data-testid="photo-viewer-slideshow-desktop"]/div/div/div/div/div/img/@src' ) if (r.present( '//div[@data-testid="photo-viewer-slideshow-desktop"]/div/div/div/div[2]/div/span/div/span' ) == True): data[str(i)]["pictext"][j - 1] = r.read( '//div[@data-testid="photo-viewer-slideshow-desktop"]/div/div/div/div[2]/div/span/div/span' ) #r.download(dl_link,f'data/{i+1}/{j}.jpg') print(f'Homestay {i+1} Photo {j} extracted!') if (r.exist('//*[@aria-label="Next"]') == False or j >= 10): break r.click('//*[@aria-label="Next"]') else: i = i - 1 #Detects Whales (Airbnb Plus spoils the format alot) k = k + 1 #Compensating Constant k print("WHALE detected, adding one more loop..") i = i + 1 #r.click('/html/body/div[9]/div/div/div/section/div/div[1]/div/button') print('Done.') return data
import time as t import openpyxl import rpa as r wb = openpyxl.Workbook() sheet = wb.active sheet.cell(row=1, column=1).value = 'Name' sheet.cell(row=1, column=2).value = 'Price' r.init() # get URL of old groceries order to re-add all items to cart # r.url(r.ask('Paste the URL of Purchase History Link and login to Nintendo')) # r.url('https://ec.nintendo.com/my/#/transactions/1') r.url('https://ec.nintendo.com/my/#/') t.sleep(7) # click on purchase history if logged in r.click( '/html/body/div[1]/div[2]/section/div[1]/section[2]/section/ul/li[3]/a/div[1]' ) t.sleep(5) r.timeout(300) # set a maximum 5-minute timeout for user to login # t.sleep(300) # use exist() function with XPath to check if logged in if not r.exist( '/html/body/div[1]/div[2]/section/div[1]/section[2]/div/div/section[1]/div[2]/div/div[1]/div[2]' ):
def extract_stay_info_as_data( ): #Generates URL/text in dict instead, shorten time for upload/download, more unified data = { "0": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "", "coordinates": "" }, "1": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "", "coordinates": "" }, "2": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "", "coordinates": "" }, "3": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "", "coordinates": "" }, "4": { "name": "", "description": "", "inventory": "", "price": "", "rating": "", "picurl": [None] * 10, "pictext": [None] * 10, "url": "", "coordinates": "" } } print('Extracting Top 5 Stay Picture Information (10 Image Max)..') url = [] url = get_stay_url() i = 0 k = 0 while (i < 5): data[str(i)]["url"] = url[i + k] r.url(url[i + k]) print(f'Extracting Text Data - Homestay {i+1}') if (r.exist('//*[@itemprop="name"]/span/h1/span') == True): data[str(i)]["coordinates"] = r.read( '//*[@data-veloute="map/GoogleMap"]/div/div/div/div[2]/a/@href' ).split("=", 1)[1].split("&", 1)[0] data[str(i)]["name"] = r.read('//*[@itemprop="name"]/span/h1/span') data[str(i)]["description"] = r.read( '//*[@href="#neighborhood"]/div') #data[str(i)]["description"]=data[str(i)]["description"].replace("\xa0"," ") data[str(i)]["inventory"] = r.read( '//*[@id="room"]/div[2]/div/div[2]/div/div/div[3]/div/div/div[1]/div/div/div[1]/div' ) + " " + r.read( '//*[@id="room"]/div[2]/div/div[2]/div/div/div[3]/div/div/div[1]/div/div/div[2]/div' ) + " " + r.read( '//*[@id="room"]/div[2]/div/div[2]/div/div/div[3]/div/div/div[1]/div/div/div[3]/div' ) + " " + r.read( '//*[@id="room"]/div[2]/div/div[2]/div/div/div[3]/div/div/div[1]/div/div/div[4]/div' ) if (r.present('//*[@id="book_it_form"]/div[4]/div[2]') == True): data[str(i)]["price"] = r.read( '//*[@id="book_it_form"]/div[4]/div[2]').split("Total", 1)[1] else: data[str(i)]["price"] = r.read( '//*[@id="book_it_form"]/div[2]').split("Total", 1)[1] #Total Price if r.present('//*[@data-heading-focus="review header"]/div'): data[str(i)]["rating"] = r.read( '//*[@data-heading-focus="review header"]/div/div/@aria-label' ) + " (" + r.read( '//*[@data-heading-focus="review header"]/div/span') + ")" else: data[str(i)]["rating"] = "No Reviews Yet" r.click('//*[@data-veloute="hero-view-photos-button"]') j = 0 while (1): j = j + 1 print(f'Extracting Picture Data - Homestay {i+1} Photo {j}') r.wait(0.4) #r.snap('//div[@data-testid="photo-viewer-slideshow-desktop"]/div/div/div/div/div/img',f"data/{i+1}/{j}.jpg") #fastest but not perfect if (r.exist('//img[@data-veloute="slideshow-image"]/@src') == True): data[str(i)]["picurl"][j - 1] = r.read( '//img[@data-veloute="slideshow-image"]/@src') if (r.present( '//*[@data-veloute="slideshow-modal"]/div/div/div[2]/div[2]/div[2]/div[2]/div' ) == True): data[str(i)]["pictext"][j - 1] = r.read( '//*[@data-veloute="slideshow-modal"]/div/div/div[2]/div[2]/div[2]/div[2]/div' ) #r.download(dl_link,f'data/{i+1}/{j}.jpg') print(f'Homestay {i+1} Photo {j} extracted!') if (r.exist('//button[@aria-label="Next"]') == False or j >= 10): break r.click('//button[@aria-label="Next"]') else: i = i - 1 #Detects Whales (Airbnb Plus spoils the format alot) k = k + 1 #Compensating Constant k print("WHALE detected, adding one more loop..") i = i + 1 #r.click('/html/body/div[9]/div/div/div/section/div/div[1]/div/button') print('Done.') return data
def sign_in_page(): r.url('https://www.amazon.com/ap/signin?_encoding=UTF8&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fgp%2Fyourstore%2Fhome%3Fie%3DUTF8%26action%3Dsign-out%26path%3D%252Fgp%252Fyourstore%252Fhome%26ref_%3Dnav_youraccount_signout%26signIn%3D1%26useRedirectOnSuccess%3D1')
def web_page_init(url): r.init() r.wait(2.0) r.url(webpage_url=url)
import rpa import pyautogui rpa.init() rpa.url('https://www.google.com.br/') pyautogui.sleep(5) #janela = pyautogui.getActiveWindow() #janela.maximize() img = pyautogui.locateOnScreen('imagens/google-pesquisa.PNG', confidence='0.8') print(img) centro_img = pyautogui.center(img) xposition, yposition = centro_img pyautogui.moveTo(xposition, yposition, 2) pyautogui.click(xposition, yposition) pyautogui.sleep(1) pyautogui.typewrite('fncit') pyautogui.sleep(1) pyautogui.press('enter') pyautogui.sleep(5) img = pyautogui.locateOnScreen('imagens/google-imagens.PNG', confidence='0.4') print(img) centro_img = pyautogui.center(img) xposition, yposition = centro_img
#list = [ #'https://api.whatsapp.com/send?phone=52133130980341&text=%C2%A1Hola!%20%F0%9F%91%8B%F0%9F%91%8B%20frutas%20y%20verdura%20para%20cuidar%20el%20sistema%20inmune%20de%20tu%20familia%3A%20%20%20%20%20%0A%F0%9F%8D%8AMandarina%20%2424.3%2Fkg%20a%20%2420.0%2Fkg%0A%F0%9F%A5%ACApio%20%2437%2Fkg%20a%20%2426%2Fkg%0A%F0%9F%8D%97Pollo%20%2494%2Fkg%20a%20%2475%2Fkg%0A%F0%9F%A5%ACEsp%C3%A1rragos%20%24101%2Fkg%20a%20%2484%2Fkg%0A%F0%9F%8D%8D%F0%9F%8D%8D%F0%9F%8D%8D', #'https://api.whatsapp.com/send?phone=5213313098034&text=%C2%A1Hola!%20%F0%9F%91%8B%F0%9F%91%8B%20frutas%20y%20verdura%20para%20cuidar%20el%20sistema%20inmune%20de%20tu%20familia%3A%20%20%20%20%20%0A%F0%9F%8D%8AMandarina%20%2424.3%2Fkg%20a%20%2420.0%2Fkg%0A%F0%9F%A5%ACApio%20%2437%2Fkg%20a%20%2426%2Fkg%0A%F0%9F%8D%97Pollo%20%2494%2Fkg%20a%20%2475%2Fkg%0A%F0%9F%A5%ACEsp%C3%A1rragos%20%24101%2Fkg%20a%20%2484%2Fkg%0A%F0%9F%8D%8D%F0%9F%8D%8D%F0%9F%8D%8D', #'https://api.whatsapp.com/send?phone=5213331385311&text=%C2%A1Hola!%20%F0%9F%91%8B%F0%9F%91%8B%20frutas%20y%20verdura%20para%20cuidar%20el%20sistema%20inmune%20de%20tu%20familia%3A%20%20%20%20%20%0A%F0%9F%8D%8AMandarina%20%2424.3%2Fkg%20a%20%2420.0%2Fkg%0A%F0%9F%A5%ACApio%20%2437%2Fkg%20a%20%2426%2Fkg%0A%F0%9F%8D%97Pollo%20%2494%2Fkg%20a%20%2475%2Fkg%0A%F0%9F%A5%ACEsp%C3%A1rragos%20%24101%2Fkg%20a%20%2484%2Fkg%0A%F0%9F%8D%8D%F0%9F%8D%8D%F0%9F%8D%8D', #'https://api.whatsapp.com/send?phone=52133130980341&text=%C2%A1Hola!%20%F0%9F%91%8B%F0%9F%91%8B%20frutas%20y%20verdura%20para%20cuidar%20el%20sistema%20inmune%20de%20tu%20familia%3A%20%20%20%20%20%0A%F0%9F%8D%8AMandarina%20%2424.3%2Fkg%20a%20%2420.0%2Fkg%0A%F0%9F%A5%ACApio%20%2437%2Fkg%20a%20%2426%2Fkg%0A%F0%9F%8D%97Pollo%20%2494%2Fkg%20a%20%2475%2Fkg%0A%F0%9F%A5%ACEsp%C3%A1rragos%20%24101%2Fkg%20a%20%2484%2Fkg%0A%F0%9F%8D%8D%F0%9F%8D%8D%F0%9F%8D%8D', #'https://api.whatsapp.com/send?phone=5213336771556&text=%C2%A1Hola!%20%F0%9F%91%8B%F0%9F%91%8B%20frutas%20y%20verdura%20para%20cuidar%20el%20sistema%20inmune%20de%20tu%20familia%3A%20%20%20%20%20%0A%F0%9F%8D%8AMandarina%20%2424.3%2Fkg%20a%20%2420.0%2Fkg%0A%F0%9F%A5%ACApio%20%2437%2Fkg%20a%20%2426%2Fkg%0A%F0%9F%8D%97Pollo%20%2494%2Fkg%20a%20%2475%2Fkg%0A%F0%9F%A5%ACEsp%C3%A1rragos%20%24101%2Fkg%20a%20%2484%2Fkg%0A%F0%9F%8D%8D%F0%9F%8D%8D%F0%9F%8D%8D', #'https://api.whatsapp.com/send?phone=5213318830312&text=%C2%A1Hola!%20%F0%9F%91%8B%F0%9F%91%8B%20frutas%20y%20verdura%20para%20cuidar%20el%20sistema%20inmune%20de%20tu%20familia%3A%20%20%20%20%20%0A%F0%9F%8D%8AMandarina%20%2424.3%2Fkg%20a%20%2420.0%2Fkg%0A%F0%9F%A5%ACApio%20%2437%2Fkg%20a%20%2426%2Fkg%0A%F0%9F%8D%97Pollo%20%2494%2Fkg%20a%20%2475%2Fkg%0A%F0%9F%A5%ACEsp%C3%A1rragos%20%24101%2Fkg%20a%20%2484%2Fkg%0A%F0%9F%8D%8D%F0%9F%8D%8D%F0%9F%8D%8D' #] #for i in range(282): for i in range(len(list)): print("Posicion: " + str(i)) #print(list[i]) r.url(list[i]) reps=0 err=False while tempNum==atmNumber: reps+=1 if reps>5: break # checkWhatsError = r.read('//*[@id="fallback_block"]/div/a') # print('Error '+ checkWhatsError) # if checkWhatsError == 'Descargar': # print('Error found') # err=True # break tempNum = r.read('//*[@id="main_block"]/div[1]/h1/p/span') print(atmNumber + " ==? " + tempNum) if n ==0:
import rpa as r # use init() to start TagUI, it auto downloads TagUI on first run # default init(visual_automation = False, chrome_browser = True) r.init() # use url('your_url') to go to web page, url() returns current URL r.url('https://ca.yahoo.com') # use type() to enter text into an UI element or x, y location # '[enter]' = enter key, '[clear]' = clear field r.type('search-box', 'github') # use read() to fetch and return text from UI element search_text = r.read('search-box') print(search_text) # use click() to click on an UI element or x, y location # rclick() = right-click, dclick() = double-click r.click('search-button') r.wait(6.6) # use snap() to save screenshot of page or UI element # page = web page, page.png = computer screen r.snap('page', 'results.png') r.snap('logo', 'logo.png') r.wait(4.4) r.click('GitHub') r.wait(10)
import rpa as r r.init(visual_automation=True) r.url("https://www.4devs.com.br/gerador_de_pessoas") def click(times, element): for i in range(1, times + 1): r.click(element) r.hover('images/arrow-down.png') click(6, 'images/arrow-down.png') r.hover('images/select-number-of-persons.png') click(1, 'images/select-number-of-persons.png') r.type('6. Gerar quantas pessoas? (Máx.: 30)', '0') r.hover('images/generate-person.png') click(1, 'images/generate-person.png') r.hover('images/download-button.png') click(1, 'images/download-button.png') r.wait(5) r.close()
import rpa as r r.init() r.url('https://fr.yahoo.com/') r.type('//*[@name="p"]', 'java in action [enter]') #print(r.read('result-stats')) #r.snap('page', 'results.png') r.close()
import pyautogui as ui import rpa import pandas as pd rpa.init() rpa.url('http://rpachallenge.com/') window = ui.getActiveWindow() window.maximize() ui.sleep(5) rpa.download('http://rpachallenge.com/assets/downloadFiles/challenge.xlsx', 'challenge.xlsx') ui.sleep(2) df = pd.DataFrame(pd.read_excel(r'challenge.xlsx', sheet_name='Sheet1')) rpa.click('/html/body/app-root/div[2]/app-rpa1/div/div[1]/div[6]/button') for row in df.itertuples(): rpa.type('//*[@ng-reflect-name="labelFirstName"]', row[1]) rpa.type('//*[@ng-reflect-name="labelLastName"]', row[2]) rpa.type('//*[@ng-reflect-name="labelCompanyName"]', row[3]) rpa.type('//*[@ng-reflect-name="labelRole"]', row[4]) rpa.type('//*[@ng-reflect-name="labelAddress"]', row[5]) rpa.type('//*[@ng-reflect-name="labelEmail"]', row[6]) rpa.type('//*[@ng-reflect-name="labelPhone"]', str(row[7])) rpa.click('/html/body/app-root/div[2]/app-rpa1/div/div[2]/form/input') ui.sleep(1) ui.sleep(5)
import rpa as r from time import sleep import pyautogui as p r.init() sleep(2) r.url('http://www.google.com') window = p.getActiveWindow() window.maximize() sleep(2) # r.type('//*[@id="tsf"]/div[2]/div[1]/div[1]/div/div[2]/input', 'Imune Kids[enter]') r.type('//*[@name="q"]', 'Imune Kids[enter]') sleep(2) r.snap('page', 'img.png') sleep(2) r.close()
# file was recycled. manually delete those 'hidden' rows and columns # NOTE2: when using lubuntu, LibreOffice Calc will not allow you to resave the file unless # reformatted to .ods. Try editing the file using Gnumeric instead to retain format as .xlsx. # loop through the rows, skip first row as the header, and print for r in range(2, sheet.max_row + 1): for c in range(1, sheet.max_column + 1): cell_obj = sheet.cell(row=r, column=c) print(cell_obj.value, end=',') print() # input the values to the rpachallenge website through web automation # this makes use of xpath (using chrome, inspect the element > right-click on highlighted element > # copy > copy xpath) bot.init() bot.url('http://www.rpachallenge.com') # start the clock bot.click('/html/body/app-root/div[2]/app-rpa1/div/div[1]/div[6]/button') # loop through the records and input onto website for r in range(2, sheet.max_row + 1): # first name bot.type('//*[@ng-reflect-name="labelFirstName"]', sheet.cell(row=r, column=1).value) # last name bot.type('//*[@ng-reflect-name="labelLastName"]', sheet.cell(row=r, column=2).value) # company name bot.type('//*[@ng-reflect-name="labelCompanyName"]', sheet.cell(row=r, column=3).value) # role in company bot.type('//*[@ng-reflect-name="labelRole"]', sheet.cell(row=r, column=4).value) # address bot.type('//*[@ng-reflect-name="labelAddress"]', sheet.cell(row=r, column=5).value) # email