present

if present(xpath/ selector / image)

test if an xpath, selector or image is present

  1. The following is useful when you are saving a file. If the file already exists, an alert window will popup to ask you if you want to replace the file.
  2. if present('img/savefile_file_exists.png')
    {
    	type page.png as y
    }
  3. Double-click on the image only if it's present
  4. if present('img/image_to_click.png')
    {
    	dclick img/image_to_click.png
    }
    
  5. Right-click at current mouse position.
  6. vision rightClick(atMouse())
  7. Entering string with backslash
  8. str = "K:\\download\\Dropbox\\download\\rpa\\tagui\\whatsapp\\"
    echo "str = " + str
    
  9. wait for page to appear
  10. total_loop = 10
    echo "waiting for page to appear"
    for (loop_wait=1; loop_wait<=total_loop; loop_wait++)
    {
    	if present('img/image_to_wait.png')
    	{
    		break;
    	}
    	echo loop_wait+". waiting for page to appear. wait for 5s ..."
    	wait 5
    }
    
  11. Use the following to get the current date and time
  12. js begin
    function formatDate(date) {
        var d = new Date(date),
            mm = '' + (d.getMonth() + 1),
            dd = '' + d.getDate(),
            yy = d.getFullYear(),
            hh = '' + d.getHours(),
            min = '' + d.getMinutes();
        return [yy.toString().substr(2,2), (mm>9?'':'0')+mm, (dd>9?'':'0')+dd].join('') + "_"+ hh+min;
    }
    today = formatDate(new Date());
    js finish
    
    report_name = "name of report"+"_"+today+".xls"
    

Comments (0)

There are no comments posted here yet

Leave your comments

Posting comment as a guest. Sign up or login to your account.
Attachments (0 / 3)
Share Your Location