B4J Library [b4j] jSelenium 2.0.1 - A Test Automation for B4J

tummosoft

Member
Licensed User
Longtime User
Thank you it works, and how to scroll the window, current i work with scrap data from google maps any idea scroll window to bottom/end of data


Thanks

- Get the entire document height with JavaScript
B4X:
documentlength = jChrome.ExecuteAsyncScript($"
            function getDocumentHeight() {
                 return document.documentElement.scrollHeight;
            }
            var callback = arguments[arguments.length - 1];
            callback(getDocumentHeight());
    "$)

- Make a scroll step

Dim nextpoint As Int = jChrome.GetScreenHeight / 2

- Begin scroll:

B4X:
If currentpos < documentlength Then
        jChrome.Scroll(0, currentpos)
        currentpos = currentpos + nextstep
    End If
 

Attachments

  • Send Keys.zip
    20.8 KB · Views: 100

syerif

Active Member
Licensed User
Longtime User


thank you for your code it is great example,

but i still can implement it in code to scroll the result until end of data

best regards
 

tummosoft

Member
Licensed User
Longtime User
The example was attach on this reply!
(1) Get height of element:
B4X:
documentlength = jChrome.ExecuteAsyncScript($"
            function getDocumentHeight() {
                 return document.querySelector("body.LoJzbe.keynav-mode-off.screen-mode:nth-child(2) div.vasquette.id-app-container.y2iKwd.cSgCkb.xcUKcd.pane-open-mode:nth-child(7) div.id-content-container:nth-child(9) div.XltNde.tTVLSc div.w6VYqd div.bJzME.tTVLSc:nth-child(2) div.k7jAl.lJ3Kh.miFGmb > div.e07Vkf.kA9KIf:nth-child(1)").scrollHeight;
            }
            
            var callback = arguments[arguments.length - 1];
            callback(getDocumentHeight());
    "$)

(2) Auto scrool by javascript
B4X:
jChrome.ExecuteScript($"
            var pos = ${currentpos};
            document.querySelector("body.LoJzbe.keynav-mode-off.screen-mode:nth-child(2) div.vasquette.id-app-container.y2iKwd.cSgCkb.xcUKcd.pane-open-mode:nth-child(7) div.id-content-container:nth-child(9) div.XltNde.tTVLSc div.w6VYqd div.bJzME.tTVLSc:nth-child(2) div.k7jAl.lJ3Kh.miFGmb > div.e07Vkf.kA9KIf:nth-child(1)").scrollTo(0,pos);
            
        "$)


 

Attachments

  • Send Keys.zip
    28.6 KB · Views: 99

syerif

Active Member
Licensed User
Longtime User
hi,
is there any way to get list from webElement with your library?

thank you
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…