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()
Exemple #2
0
def change_password(username, new_password):
    #//*[@id="content-main"]/div[9]/table/tbody/tr/th/a
    element = '//tr[@class="model-user"]/th/a'
    r.click(element)
    #//Element[@attribute1="abc" and @attribute2="xyz" and text()="Data"]
    #user_elem = f'//td[@class="field-name" and text()="{username}"]' #/preceding-sibling::th[@class="field-id"]/a'
    user_elem = f'//td[text()="{username}"]/preceding-sibling::th[@class="field-id"]/a'
    r.click(user_elem)
    pwd_form_elem = '//a[@href="../password/"]'
    r.click(pwd_form_elem)

    pwd1_elem = '//input[@id="id_password1"]'
    r.click(pwd1_elem)
    r.type(pwd1_elem, new_password)
    pwd2_elem = '//input[@id="id_password2"]'
    r.click(pwd2_elem)
    r.type(pwd2_elem, new_password)

    submit_elem = '//input[@type="submit"]'
    r.click(submit_elem)

    success_elem = '//ul[@class="messagelist"]/li[@class="success"]'
    txt = r.read(success_elem)
    print('CLICK')
    return txt
Exemple #3
0
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')
Exemple #4
0
def enter_country_city(city):
    print(f'Entering City Information...{city}')
    r.click('//*[@aria-label="Search"]')
    r.type('//*[@placeholder="Add city, landmark, or address"]', city)
    #r.type('//*[@id="Koan-via-SearchHeader__input"]', city)
    #r.click('//*[@id="Koan-via-SearchHeader__option-0"]')

    print('Done.')
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 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 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]")
Exemple #8
0
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
Exemple #9
0
def login():  # GG CAPTCHA (abandoned ship)
    r.click('//header[@role="banner"]/div/div/div[3]/div/div/nav/ul/li[6]')
    r.wait(10)
    if r.present('//div[@aria-label="Log in"]/div[2]/div[4]/button') == True:
        # Anti RPA by AirBnB
        r.click('//div[@aria-label="Log in"]/div[2]/div[4]/button')
    if r.present('//button[@data-testid="social-auth-button-email"]') == True:
        # Anti RPA by AirBnB
        r.click('//button[@data-testid="social-auth-button-email"]')
    r.type('//*[@id="email"]', USERNAME)
    r.type('//*[@id="password"]', PASSWORD)
    r.click('//button[@data-veloute="submit-btn-cypress"]')
    r.click('//*[@id="recaptcha-anchor"]/div[1]')
Exemple #10
0
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')
Exemple #12
0
def start_challenge(data_frame, labels_list):
    r.click('/html/body/app-root/div[2]/app-rpa1/div/div[1]/div[6]/button')
    count_round = 1

    for row in data_frame.itertuples():
        if count_round == 11:
            break

        else:
            for label in range(0, 7):
                row_converted_to_string = str(row[label + 1])
                if label == 6:
                    r.type(f'//*[@ng-reflect-name="{labels_list[label]}"]',
                           row_converted_to_string[:-2])
                else:
                    r.type(f'//*[@ng-reflect-name="{labels_list[label]}"]',
                           row_converted_to_string)

            r.click(
                '/html/body/app-root/div[2]/app-rpa1/div/div[2]/form/input')
            count_round += 1
Exemple #13
0
import rpa as r

r.init()
r.url('https://www.google.com')
r.type('//*[@name="q"]', 'Fatec São Paulo[enter]')
r.click('#rso > div:nth-child(1) > div > div > div > div.yuRUbf > a > h3')
r.snap('page', 'print_fatec.png')
r.close()
Exemple #14
0
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)
ui.screenshot('score.png')
rpa.close()
def username_pw():
	r.type('text','********[enter]')
	r.type('text','********[enter]')
Exemple #16
0
import rpa as r

r.init(visual_automation=True)
r.dclick('outlook_icon.png')
r.click('new_mail.png')
...
r.type('message_box.png', 'message')
r.click('send_button.png')
r.close()
Exemple #17
0
import rpa as r
import pyautogui as p
r.init()
r.url('http://www.google.com')

r.wait(2.0)

r.type('/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input', 'lubrificador para sexo anal[enter]')

r.wait(2.0)

r.snap('page', 'rpa_search.png')
r.wait(2.0)
r.close()
Exemple #18
0
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()
def enter_country_city(city):
    print(f'Entering City Information...{city}')
    r.type('//*[@id="Koan-via-SearchHeader__input"]', city)
    r.click('//*[@id="Koan-via-SearchHeader__option-0"]')
    print('Done.')
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()
Exemple #21
0
window = p.getActiveWindow()
window.maximize()

sleep(4)

df = pd.read_excel('challenge.xlsx', sheet_name='Sheet1')
datas = pd.DataFrame(df,
                     columns=[
                         "First Name", "Last Name ", "Company", "Name",
                         "Role in Company", "Address Email"
                         "Phone Number"
                     ])
r.click('/html/body/app-root/div[2]/app-rpa1/div/div[1]/div[6]/button')
for collumn in df.itertuples():
    print(collumn)
    r.type('//*[@ng-reflect-name="labelFirstName"]', str(collumn[1]))
    r.type('//*[@ng-reflect-name="labelLastName"]', str(collumn[2]))
    r.type('//*[@ng-reflect-name="labelCompanyName"]', str(collumn[3]))
    r.type('//*[@ng-reflect-name="labelRole"]', str(collumn[4]))
    r.type('//*[@ng-reflect-name="labelAddress"]', str(collumn[5]))
    r.type('//*[@ng-reflect-name="labelEmail"]', str(collumn[6]))
    r.type('//*[@ng-reflect-name="labelPhone"]', str(collumn[7]))
    r.click('/html/body/app-root/div[2]/app-rpa1/div/div[2]/form/input')

sleep(3)
p.screenshot('score.png')
r.close()
exit()
'''
<input _ngcontent-c2="" ng-reflect-name="labelFirstName" id="Z84Lc" name="Z84Lc" class="ng-pristine ng-invalid ng-touched">
'''
#output.write(req.content) #populates the source into the file
#output.close()  #closes and saves the file
#---- at this point the file should be ready to be read

#if neither the download or the requests.get work - using rpa.click() to click on the css object to download works but takes extra steps

# load and prepare all data to string with pandas
df = pd.read_excel('challenge.xlsx')
df['Phone Number'] = df['Phone Number'].astype(str)

# timer starts after running this step
r.click('//*[text()="Start"]')

# iterate and populate each text box on the page
for i in range(len(df.axes[0])):
    r.type('//*[@ng-reflect-name="labelFirstName"]', df['First Name'][i])
    r.type('//*[@ng-reflect-name="labelLastName"]', df['Last Name '][i])
    r.type('//*[@ng-reflect-name="labelCompanyName"]', df['Company Name'][i])
    r.type('//*[@ng-reflect-name="labelRole"]', df['Role in Company'][i])
    r.type('//*[@ng-reflect-name="labelAddress"]', df['Address'][i])
    r.type('//*[@ng-reflect-name="labelEmail"]', df['Email'][i])
    r.type('//*[@ng-reflect-name="labelPhone"]', df['Phone Number'][i])
    r.click('//*[@value="Submit"]')

# page as identifier means the webpage
r.snap('page', 'score.png')
r.wait(10)
r.close()

#---End of program | https://github.com/eabdiel
Exemple #23
0
import rpa as r

r.init()
r.url('https://cn.bing.com/')
r.type('//*[@name="q"]', 'decentralization[enter]')
print(r.read('result-stats'))
r.snap('page', 'results.png')
r.close()
import rpa as r
import numpy as np
import cv2
from PIL import Image
import pytesseract
from twilio.rest import Client

# open browser
r.init(True)
# go to amazon 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'
)
# sign into amazon account
r.type('text', '******[enter]')  # enter amazon username here
r.type('text', '*******[enter]')  # enter password here
# click to go to delivery window page
r.click('Cart')
r.click('Checkout Whole Foods Market Cart')
r.click('continue')
r.click('continue')
r.wait(20)
# save screenshot file
r.snap('page', 'results.png')

# use open to extract delivery availability msg
filename = 'results.png'
img = cv2.imread(filename)
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)  # convert to gray
filename_gray = filename + '_box.jpg'
cv2.imwrite(filename_gray, imgray)
                    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]
            # main function
            gestionar_uuii(ui, cp, cto)
# If the website log out you during the process
elif r.url() == 'http://xxxxorType=logoff':
    user = input("Introduce el usuario de FDTT: ")
Exemple #26
0
import rpa as r
import pyautogui as p

r.init()
r.url('http://www.google.com')
janela = p.getActiveWindow()
janela.maximize()
r.wait(2.0)
r.type('//*[@id="tsf"]/div[2]/div[1]/div[1]/div/div[2]/input', 'RPA[enter]')
r.wait(2.0)
r.snap('page', 'rpa_page.png')
r.wait(2.0)
r.close()
Exemple #27
0
# 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)

# use snap() to save screenshot of page or UI element
# page = web page, page.png = computer screen
Exemple #28
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)
Exemple #29
0
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()
Exemple #30
0
    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
    bot.type('//*[@ng-reflect-name="labelEmail"]', sheet.cell(row=r, column=6).value)
    # phone number
    bot.type('//*[@ng-reflect-name="labelPhone"]', str(sheet.cell(row=r, column=7).value))
    # click submit
    bot.click('/html/body/app-root/div[2]/app-rpa1/div/div[2]/form/input')
# get result