Ask a Question

How to ScrollUp/Down web page to find a specific element? (Python)

SOLVED
tashish
New Contributor

How to ScrollUp/Down web page to find a specific element? (Python)

I want to create a generic function for scroll up/down which will perform the function until the element is visible

1 ACCEPTED SOLUTION

Accepted Solutions
sonya_m
Community Manager

Re: How to ScrollUp/Down web page to find a specific element? (Python)

Hi @tashishIf you want to find a specific element on a page, you can use special TestComplete features. If an element exists on a page, the tool will find it even if it's under the scroll. I recommend that you read the following article containing more information about finding objects on a web page:
https://support.smartbear.com/testcomplete/docs/app-testing/web/general/common-tasks/finding-objects...

 

If you do need to scroll until the target object, please use Alex's suggestion - you need to call the scrollIntoView method. You can find an example of how to do this on one of the previous conversations:

https://community.smartbear.com/t5/TestComplete-Functional-Web/How-can-i-Scroll-to-view-an-element-a... 


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

5 REPLIES 5
BenoitB
Community Hero

Re: How to ScrollUp/Down web page to find a specific element? (Python)

And do you want we write it for you ?

Please put your trial before asking.

Un sourire et ça repart

tashish
New Contributor

Re: How to ScrollUp/Down web page to find a specific element? (Python)

Okay. Solution Accepted. Thank you for the big help.

BenoitB
Community Hero

Re: How to ScrollUp/Down web page to find a specific element? (Python)

Sorry i didnt want to be rude but here we are all volunteer, taking our time trying help others.
But as for me you ask a solution without telling us what is your real problem ( scrolling, loop, visible) and no even showing the ideas and trials made.
And that make me feel like we are free dev for others....we aren't that.

So explain more, show you have think about the problem and we can work together..not alone

Un sourire et ça repart

AlexKaras
Community Hero

Re: How to ScrollUp/Down web page to find a specific element? (Python)

Hi,

 

While @BenoitB is absolutely correct with his notes and questions, try to read the documentation for the .scrollIntoView native DOM method. Usually it works well.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
sonya_m
Community Manager

Re: How to ScrollUp/Down web page to find a specific element? (Python)

Hi @tashishIf you want to find a specific element on a page, you can use special TestComplete features. If an element exists on a page, the tool will find it even if it's under the scroll. I recommend that you read the following article containing more information about finding objects on a web page:
https://support.smartbear.com/testcomplete/docs/app-testing/web/general/common-tasks/finding-objects...

 

If you do need to scroll until the target object, please use Alex's suggestion - you need to call the scrollIntoView method. You can find an example of how to do this on one of the previous conversations:

https://community.smartbear.com/t5/TestComplete-Functional-Web/How-can-i-Scroll-to-view-an-element-a... 


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: