How to scroll for browser

Ask general questions here.
[email protected]@
Posts: 18
Joined: Fri Dec 27, 2019 12:16 pm

How to scroll for browser

Post by [email protected]@ » Thu Jan 16, 2020 10:24 am

Hi,
I am using ranorex version 8.3.1, chrome version 79.0.3945.117 , window 10 64bit
I use action " mouse wheel " but it don't work.
In selenium use javascript to scroll, can ranorex use it? If yes, please show me the sample code
Any idea as what could be the issue and how to resolve it?
Thanks

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6016
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to scroll for browser

Post by odklizec » Thu Jan 16, 2020 11:22 am

Hi,

Could you please add a bit more details about what exactly is not working (error message, entire report, snapshot of problematic element,...) and how exactly you implemented the mouse wheel action?

Sadly, Ranorex 8.3.1 is way too old and no longer supported. On the other hand, mouse wheel action should work even in this old version and I don't remember any specific problem with mouse wheel in 8.3.1. So, my guess is, that it's either your implementation of the mouse wheel action or the element you are trying to scroll does not support mouse wheel action?

Also, Java Script action could be invoked by using below script:

Code: Select all

webDocument.ExecuteScript("java.script.code.you.want.to.use;");
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

[email protected]@
Posts: 18
Joined: Fri Dec 27, 2019 12:16 pm

Re: How to scroll for browser

Post by [email protected]@ » Thu Jan 16, 2020 12:38 pm

I wrote a method as image attach
But it isn't display in list library of action "user code"
Attachments
Capture.PNG
Capture.PNG (5.51 KiB) Viewed 258 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6016
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to scroll for browser

Post by odklizec » Thu Jan 16, 2020 1:21 pm

Hi,

I'm not quite sure if user code methods supports methods with WebDocument as parameter? Have you tried it without this parameter?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

[email protected]@
Posts: 18
Joined: Fri Dec 27, 2019 12:16 pm

Re: How to scroll for browser

Post by [email protected]@ » Fri Jan 17, 2020 4:00 am

i tried it without this parameter, but it don't work :cry:
Attachments
Capture.PNG
Capture.PNG (7.69 KiB) Viewed 237 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6016
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to scroll for browser

Post by odklizec » Fri Jan 17, 2020 8:26 am

Hi,

Does not work what exactly? The method is still not visible in the list of available methods or it does not scroll?

I've just tried the code you posted with DOM element of this forum (in FF, via Spy and ExecuteScript) and it happily scrolled the page to bottom. So if it does not scroll your page, the problem is either with the page (does not support scroll) or the browser you are using? Have you tried KeyShortcut action and "End" shortcut? Another possibility could be, that there is a bug in 8.3.1, related to ExecuteScript. But since 8.3.1 is no longer supported, you will have to try it with 9.2.1. There is no way around this.

BTW, I see you are using Chrome browser? Please examine the given web page in Chrome, using Ranorex Spy. Is the page available in Spy as DOM element? If not, then you have your answer. The problem is, that the Ranorex plugin is most probably not installed in Chrome or the existing plugin installation is broken. Try to uninstall/reinstall Chrome plugin and try it again. Oh and make sure Chrome is not running in background after closing Chrome window! It's a default Chrome behavior and must be changed in its Settings.

If the method is not available in the list of methods, then it's most probably not defined correctly? In this case, please post here your entire solution. And as above, try it with 9.2.1. Version 8.3.1 is a dead horse ;) Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

[email protected]@
Posts: 18
Joined: Fri Dec 27, 2019 12:16 pm

Re: How to scroll for browser

Post by [email protected]@ » Tue Jan 21, 2020 5:08 am

Hi,
I tried my code on version 9.2.0 but it sill do not scroll the page to bottom.
My page has support scroll
I had disable "Continue running background apps when Google Chrome is closed" in setting of chrome
Please help me
Thanks you verry much

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6016
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to scroll for browser

Post by odklizec » Tue Jan 21, 2020 8:05 am

Hi,

Have you examined the page with Spy, as I suggested in my previous post? Is the page visible as DOM element?

Also, have you tried to run the script via Spy? Try it both with your page and for example Ranorex page, to see if the script is working. I tried it with Ranorex page and it works OK for me (with Chrome).

BTW, a most recent version of Ranorex is 9.2.1. Although I don't think that 9.2.0 is causing your issue, it's definitely good idea to use the most recent version.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

[email protected]@
Posts: 18
Joined: Fri Dec 27, 2019 12:16 pm

Re: How to scroll for browser

Post by [email protected]@ » Tue Jan 21, 2020 8:18 am

Hi,
My page is visible as DOM element in Spy
I tried run script with Ranorex Forum and it worked but My page don't work
I run on version 9.2.1

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6016
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to scroll for browser

Post by odklizec » Tue Jan 21, 2020 8:42 am

Hi,

So, if Ranorex page works and your don't, then I'm afraid, your page (its implementation) is a most probable cause of the problem?

BTW, have you tried to use Shortcut Key action (with key 'End'), as I suggested in previous post?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

[email protected]@
Posts: 18
Joined: Fri Dec 27, 2019 12:16 pm

Re: How to scroll for browser

Post by [email protected]@ » Tue Jan 21, 2020 1:08 pm

Hi,
I tried use Shortcut Key action (with key 'End') as your suggest but I need click a any point of screen then it work
However my page display list data , so when I select a any point on page,a any data will be selected, impact my data test
Any idea as what could be the issue and how to resolve it?
Thanks

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6016
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to scroll for browser

Post by odklizec » Tue Jan 21, 2020 1:45 pm

Hi,

Send the End shortcut to browser's main form, instead of sending it to DOM element. Simply create a new repo element, with xpath like this:
/form[@processname='chrome'] and then use this repo element in KeySequence action. Hope this helps?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

[email protected]@
Posts: 18
Joined: Fri Dec 27, 2019 12:16 pm

Re: How to scroll for browser

Post by [email protected]@ » Thu Jan 30, 2020 8:52 am

Thanks for your support, I resolved issue

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6016
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to scroll for browser

Post by odklizec » Thu Jan 30, 2020 9:20 am

Hi,

You are welcome. Could you please share your solution? Thanks ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

[email protected]@
Posts: 18
Joined: Fri Dec 27, 2019 12:16 pm

Re: How to scroll for browser

Post by [email protected]@ » Thu Jan 30, 2020 10:14 am

I double click a any position of screen, before use action Shortcut Key action (with key 'End'), it work good and not impact any data is displayed on screen :lol: