search_text = t.read('search-box') # use echo() to print to output, same as Python print() t.echo(search_text) # use click() to click on an UI element or x, y location # rclick() = right-click, dclick() = double-click t.click('search-button') # use wait() to wait for a number of seconds # default wait() is 5 seconds t.wait(6.6) # use snap() to save screenshot of page or UI element # page = web page, page.png = computer screen t.snap('page', 'results.png') t.snap('logo', 'logo.png') # another example of interacting with a web page # include http:// or https:// in URL parameter t.url('https://duckduckgo.com') t.type('search_form_input_homepage', 'The search engine that doesn\'t track you.') t.snap('page', 'duckduckgo.png') t.wait(4.4) # use close() to close TagUI process and web browser # if you forget to close, just close() next time t.close() # in above web automation example, web element identifier can be XPath selector, CSS selector or
t.keyboard('[esc]') t.wait(2) t.click('//*[@id="banking"]/div[2]/div/div/div/a') t.wait(4) t.click('//*[@id="banner"]/div[2]/a') t.wait(5) t.click('//*[@id="username"]') t.type('//*[@id="username"]','29KRISHNAJI') t.wait(4) t.type('//*[@id="label2"]','TUTAC2017%[enter]') t.wait(5) t.click('//*[@id="contentDiv"]/div[2]/div[2]/div[4]/a') path=r'C:\Users\garv2\Desktop\SBI\balance.jpeg'#PATH balance="balance"+str(filename) path=path.replace("balance",balance) t.snap('page',path) t.wait(3) t.click('//*[@id="navbar"]/div[1]/a[1]') t.wait(2) t.click('//*[@id="contentDiv"]/div/div/div[2]/div[2]/div[2]/h3/a') t.wait(2) t.click('//*[@id="bydate"]') t.wait(2) t.click('//*[@id="startdate"]') t.wait(2) t.keyboard('[left]') t.wait(2) t.keyboard('[enter]') t.wait(2) t.click('//*[@id="iconExcel"]/span') t.wait(3)
def url2png(url): t.init() t.url(url) # t.type('q', 'decentralization[enter]') t.snap('page', 'results-' + str(uuid.uuid1()) + '.png') t.close()
from google.cloud import storage import datetime # import webbrowser # import threading cred = credentials.Certificate('./static/e-charger-303306-510a928eb8dd.json') firebase_admin.initialize_app(cred) db = firestore.client() client = storage.Client.from_service_account_json( './static/e-charger-303306-510a928eb8dd.json') t.init() t.url('https://eservices.healthhub.sg/') t.wait(6) t.snap('//a[contains(@href, "singpassmobile.sg/qrlogin")]', 'qrcode.png') t.close() bucket = client.bucket("e-charger-303306.appspot.com") blob = bucket.blob("qrcode.png") blob.upload_from_filename('qrcode.png') url = blob.generate_signed_url(version="v4", expiration=datetime.timedelta(minutes=60), method="GET") db.collection(u'QRCode').document(u'4OGsFShm0OmuTq8a5c7J').set( {u'qrCodeUrl': url}) # qrcode_ref = db.collection(u'QRCode').document(u'4OGsFShm0OmuTq8a5c7J') # qrcode = qrcode_ref.get() # qrcode_url = qrcode.to_dict()['qrCodeUrl']