Web scrapping with JAVA based website

Pankil

New Member
Joined
Aug 1, 2019
Messages
16
Hello all,

current issue is that i am working on one website where it run JAVA script to load data and i need to copy that data once it complete loading. now loading time is not fixed so my code run before it completes loading. do some event and readystate=4 is not working on this.

is there any way we can delay vba code till java load data?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hey,

thanks buddy but are you sure? i think this is not working when we are working with java because i already tried that.
 
Upvote 0
Yes Buddy I am sure.

here is an example of some code within a sub procedure

bot.FindElementById("R_T_ENTRY_WEB_ACTIVITY_ID$0").Click
bot.FindElementById("R_T_ENTRY_WEB_ACTIVITY_ID$prompt$img$0").Click
bot.SwitchToParentFrame
bot.SwitchToFrame (3)
Application.Wait Now + TimeValue("00:00:01")
bot.FindElementById("RESULT0$9").Click
bot.SwitchToParentFrame
bot.SwitchToFrame (0)
Application.Wait Now + TimeValue("00:00:01")
 
Last edited:
Upvote 0
Hey Awesome..just one query that java takes different time depend on speed of internet to load data. so say if i hold it for 5 secs and java take 10 sec. it will give error. if so then can we hold it dynamically?
 
Last edited:
Upvote 0
You would have to use WScript.Shell since it has a waitOnReturn option.

Reference:
https://stackoverflow.com/questions/15951837/wait-for-shell-command-to-complete
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
</code>wsh.Run "C:\folder\runbat.bat", windowStyle, waitOnReturn



 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,387
Members
448,956
Latest member
JPav

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top