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()
示例#2
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
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()
示例#4
0
def login():
    r.init(visual_automation=True, chrome_browser=False)
    r.run('E:\soft_isruning_position\WXWork\WXWork.exe')
    r.click("h.jpg")
    r.click("3.png")
    r.wait(1.5)

    is_true = r.exist("aa.png")
    print(is_true)
    if is_true:
        r.snap(
            "step-6.png",
            filename_to_save=
            r"D:\projects\S_Git_proj\spider\Other\spider_all\Rpa-Python\image")
        print("截图")
        print("进行图片传输")
        r.wait(1.5)

        is_true = r.exist('step-1.png')
        if is_true:
            print("login success")
        else:
            print("login fail")
import rpa as r

r.init(visual_automation=True, chrome_browser=False)
r.keyboard('[cmd][space]')
r.keyboard('safari[enter]')
r.keyboard('[cmd]t')
r.keyboard('joker[enter]')
r.wait(2.5)
r.snap('page.png', 'results.png')
r.close()
示例#6
0
def end_challenge():
    r.snap('page', 'registry.png')
    r.wait(1)
    r.close()
示例#7
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()
示例#8
0
# 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
print('RPA Challenge result: ' + bot.read('/html/body/app-root/div[2]/app-rpa1/div/div[2]/div[2]'))
# take screenshot
bot.snap('page', 'rpa-challenge-result.png')
# close the browser
bot.close()
示例#9
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()
示例#10
0
def urlSnap():
    r.init(visual_automation=True)
    r.url('https://www.google.com')
    r.type("q", "CEG[enter]")
    print(r.read('result-stats'))
    r.snap('page', 'results.png')
示例#11
0
# 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
r.snap('page', 'results.png')
r.snap('logo', 'logo.png')

# another example of interacting with a web page
# include http:// or https:// in URL parameter
r.url('https://duckduckgo.com')
r.type('search_form_input_homepage', 'The search engine that doesn\'t track you.')
r.snap('page', 'duckduckgo.png')
r.wait(4.4)

# use close() to close TagUI process and web browser
# if you forget to close, just close() next time
r.close()

# in above web automation example, web element identifier can be XPath selector, CSS selector or
# attributes id, name, class, title, aria-label, text(), href, in decreasing order of priority
示例#12
0
import rpa as r
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile

df = pd.read_excel('book1.xlsx', sheet_name='Sheet1')
count = 1
while (count < 11):
    count = count + 1
    r.init()
    sc2url = df.iloc[0, count]
    sc2user = df.iloc[1, count]
    temppass = df.iloc[2, count]
    newpass = "******"
    r.url(sc2url)
    r.click('//*[@id="internal-panel"]/label[1]/span/a')
    r.type('#username', '[clear]')
    r.type('#username', sc2user)
    r.type('#password', '[clear]')
    r.type('#password', temppass + '[enter]')
    r.type('#newPassword', '[clear]')
    r.type('#newPassword', newpass)
    r.type('#confirmNewPassword', '[clear]')
    r.type('#confirmNewPassword', newpass + '[enter]')
    r.snap('page', 'results' + str(count) + '.png')
    r.close()
示例#13
0
import rpa as r

r.init()
r.url('https://www.buda.com/ingreso')
r.type('318,50', '[email protected][enter]')
#print(r.read('Web Results'))
r.snap('page', '../RPA/results.png')
r.close()
示例#14
0
  def sigaaRPA(self):
    r.init()
    r.timeout(30)

    while(self.state > 0):

      if self.terminateBot:
        r.close()
        break

      elif self.state == 1:
        # use url('your_url') to go to web page, url() returns current URL
        r.url('https://sigaa.upb.edu.co/ssomanager/c/SSB')
        self.state = self.state + 1

      elif self.state == 2:
        # use type() to use the keyboard to write something
        if r.exist(X.username) & r.present(X.username):
          r.type(X.username, '000290164')
          r.type(X.password, 'Tandres1997_')
          self.state = self.state + 1
        else:
          print("Couldn\'t find Username and Password Components")
          self.state = 1

      elif self.state == 3:
        # use click() to click on an UI element or x, y location
        self.state = click(X.login, self.state)

      elif self.state == 4:
        ## hace click en Estudiantes
        self.state = click(X.estudiantes, self.state)

      elif self.state == 5:
        ## Hace click en Seguimiento a la formación
        self.state = click(X.seguimieto, self.state)

      elif self.state == 6:
        ## hace click en Calificaciones parciales
        self.state = click(X.calif, self.state)

      elif self.state == 7:
        ## Selecciona el semestre del cual quiere mirar las notas
        r.select(X.semester, self.semester)
        self.state = self.state + 1

      elif self.state == 8:
        ## se hace click en enviar
        r.click(X.enviar)
        self.state = self.state + 1

      elif self.state == 9:
        tablexpath = ''
        r.wait(2)
        numCursos = r.count('//*[@class="datadisplaytable"][2]/tbody/tr/td/a')
        for i in range(2,numCursos+2):
          tablexpath = '//*[@class="datadisplaytable"][2]/tbody/tr['+ str(i) +']/td/a'
          if r.exist(tablexpath):
            r.click(tablexpath)
            r.wait(1)
            pagetitle = r.read('//div[@id="pagetitle"]')
            if pagetitle == 'Detalle de Calificación de Componente':
              materia = r.read('//*[@class="datadisplaytable"][1]/tbody/tr[5]/td[2]')
              print(materia)
              r.snap('page', './notas/s'+self.semester+'/'+ materia +'.png')
              # r.table('//table[@class="datadisplaytable"][2]', './csv/table'+str(i-1)+'.csv')
            r.dom('history.back()')

        # use wait() to wait for a number of seconds
        # default wait() is 5 seconds
        r.wait(5)
        self.terminateBot = True
      elif self.state == 10:
        r.dom('history.back()')
def snap():
	r.wait(20)
	r.snap('page','results.png')
示例#16
0
#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
示例#17
0
def snap_map():
    print('Downloading Map..')
    r.snap('//*[@id="ExploreLayoutController"]/div/div[3]/aside/div',
           "map.jpg")
    print('Done."')
示例#18
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()
示例#19
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()
示例#20
0
import rpa as r

r.init(visual_automation=True)
r.type(600, 300, 'open source')
r.click(900, 300)
r.snap('page.bmp', 'results.bmp')
r.hover('button_to_drag.bmp')
r.mouse('down')
r.hover(r.mouse_x() + 300, r.mouse_y())
r.mouse('up')
r.close()