aisingapore / TagUI

Free RPA tool by AI Singapore
Apache License 2.0
5.67k stars 584 forks source link

count() returning 0 - resolved after adding wait step before count(), as webpage loads slow #1091

Closed munishmarya closed 3 years ago

munishmarya commented 3 years ago

Hi,

I have used tagui in past and its great, but this is my first time dealing with xpath. I am using below flow but tagui is reading count of rows as zero while in the webpage there are 51 instances of the xpath (I checked xpath using chrome console result was 51)

results from tagui:


START - automation started - Tue Aug 03 2021 10:08:37 GMT+0530 (India Standard Time) keyboard [win]r keyboard chrome[enter] wait 2 keyboard [ctrl][v][enter] wait 2 dump date, community, propertyname, type, bedroom, price, sqft, pricesqft to drivenproperties.csv 'row counted' 0


flow used:


keyboard [win]r keyboard chrome[enter] clipboard('https://www.drivenproperties.com/dubai-real-estate-market-guide/rental-transactions') wait 2 keyboard [ctrl][v][enter] wait 2 dump date drivenproperties.csv rows = count('//[@id="dpx-sold-grid-tbody"]/tr') echo 'row counted' rows for row from 1 to rows echo 'for started ' row read //[@id="dpx-sold-grid-tbody"]/tr[row]/td[2] to date


ruthtxh commented 3 years ago

Hi @munishmarya

Instead of using keyboard and clipboard to access the webpage you can directly access it with the url as a step

https://www.drivenproperties.com/dubai-real-estate-market-guide/rental-transactions
rows = count('//*[@id="dpx-sold-grid-tbody"]/tr')
echo `rows`

doing this in live mode gives the result of 51 for me: image

munishmarya commented 3 years ago

thanks for reply @ruthtxh . I tried again following your approach but same results for me 0 rows, i am saving the flow and using cmd to run. I have used the latest package from https://tagui.readthedocs.io/en/latest/setup.html

@ruthtxh edited 18.03 IST I tested in live mode, starge enough it worked with 51 results but why on flow execution from command prompt it returns 0??

flow results


image

flow used:

https://www.drivenproperties.com/dubai-real-estate-market-guide/rental-transactions
rows = count('//*[@id="dpx-sold-grid-tbody"]/tr')
echo `rows`
ruthtxh commented 3 years ago

Hi @munishmarya, seems like the webpage takes a while to load. You may add a wait step in between like this for a 3 second delay:

https://www.drivenproperties.com/dubai-real-estate-market-guide/rental-transactions
wait 3
rows = count('//*[@id="dpx-sold-grid-tbody"]/tr')
echo `rows`

see diff after adding the wait step: image image

munishmarya commented 3 years ago

@ruthtxh thanks, you are a star. It worked after wait time, have patience let it load :)

ruthtxh commented 3 years ago

@munishmarya no problem, feel free to ask anything!

kensoh commented 3 years ago

Adding on, if you prefer a dynamic wait time instead of a fixed time, you can use hover step on some element that only shows up when the page is fully loaded. That way, once the page is done loading, automation proceeds.