How to test if the bottom of the web page has reached?

Hello
I have to test if in a certain moment the bottom of the page was reached. I’ve googled a lot by I don’t find a solution that can work in my UiPath application. Any idea?

Have you tried to use “Image Exists” Activity?

Insert the “Image Exists” Activity inside a loop. So until a certain image (on the bottom of the page) has not loaded, the Uipath will wait until it’s ready.

Follow a simple example:
imageExists_Example.xaml (13.6 KB)

Hope It Helps!

Regards,

Hi Lucas
Thank you for the solution but can’t be applied in my case. I’m looking for something that works with the scroll properties of an UI element
Regards

Hi @aksh1yadav
No word at the bottom of the page.
Thank man!

Sorry, but I have to test if the bottom has reached. I don’t have to jump to the end of the page.
Maybe I don’t understand your idea.

Yeah correct …got it wrong… My fault. When will free get back to you.

I think we can try with scroll properties but may I ask if you can try the example sent my Mr. @Lucas.Pimenta with scroll bar image (below) or you don’t want the Image validation at all?

1 Like

Hi @vvaidya
I’ve tried the @Lucas.Pimenta solution mixed with yours image but seems that it doesn’t works. And I’m not sure that using this kind of solution will work with any windows theme. It will be nice to be protected from this kind of issues.
In this case using element’s properties will be more safe.
Regards

Attached is the solution. I have used injectjs which returns true as soon as it reaches bottom of the page. Hope it helps.

Its not letting me upload js files, so below is the script

function(e) {
    if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
        return 'true';
    }
    else
    {
	return 'false';
    }
};

injectJs.xaml (12.4 KB)

5 Likes

I’'m trying your last solution and I’m getting error:
Inject js : Exception from HRESULT: 0x80020101

:frowning:

I’ve changed the browser to IE and I’m also changed the selector.

is it for your url or for microsoft.com only?

any url

That Error generally occurs when you have a syntax error in the Javascript,

Please try with this attached sample workflow and let me know :slight_smile:

InjectSampleJs.zip (2.6 KB)

Regards…!!
Aksh

1 Like

Even if Mr @aksh1yadav script doesn’t work. Try below script or paste your own script and correct it.

jsFiddle Demo

Thanks to everybody for the solution with inject JS. It works fine now.
Regards

Hello @vvaidya and @aksh1yadav ,
I tried your script on www.linkedin.com and its always returning ‘false’ even when im completely scrolled to the bottom of the page. For example navigate to any profile on www.linkedin.com (ive been using LinkedIn Login, Sign in | LinkedIn). I have a do while loop with the inject js activity inside. Im stuck in an infinite loop because the js function is always returning ‘false’. Any ideas on how to modify the function? Ive also tried
window.onscroll = function (e) {
if ((window.innerHeight + window.pageYOffset) >= document.body.offsetHeight) {
return true;
}
else {
return false;
}
};

with no luck. Thanks in advanced.

hey @KaylaC

Hey your mentioned page is working on onscroll load with ajax :slight_smile: so depdens on data it will take time in loop as well.

First important thing which browser you are using? if chrome and firefox it is still working for me

but if it is IE10 or IE11 then you have to change your code a bit :slight_smile:

function(e) {
if ((window.innerHeight + window.pageYOffset) >= document.body.offsetHeight) {
return ‘true’;
}
else
{
return ‘false’;
}
};

in my earlier code i was using ScrollY so with latest IE just we have to replace it with pageYOffset.

The above code will work with all Latest browser :slight_smile: even with Chrome and firefox as well

Regards…!!
Aksh

1 Like

@aksh1yadav
Thank you so much that worked! Any ideas/suggestions on how to do the same thing for twitter.com? I’m actually having the opposite problems as before, the JS function is always returning True. I have attached the do while loop i am using to try to scroll to the bottom of https://twitter.com/CowBow_/following. The delay i have is for 5 seconds. Thanks again!


image