|
-
Mar 30th, 2004, 04:05 PM
#1
Thread Starter
New Member
webbrowser control-click on an image programatically
Hi, I have the following problem:
I am a sports better. and i use www.betfair.com to do online betting. when there is an event, the odds are refreshed every 20 seconds or if i click a little refresh button on the page.
i have spent hours and hours reading through loads of forums to find a way to locate that element in the webbrowser.document.elements section. but i cant find a way of clicking it.. i have looked at the source code and theres an image, with an onclick="RefreshMarket();" so ive tried to use :
web.navigate("javascript:RefreshMarket();")
it wont work, will give me an error.
If someone has time, or has a similar question and has any information please help me.
Thanks a lot
Phillipp
-
Mar 30th, 2004, 11:31 PM
#2
I wonder how many charact
RefreshMarketView is actually what the click of the image calls. It in turn calls a function DoRefresh with DoRefresh(0)...
it is within this function,
Code:
function DoRefresh(iInitType){
/*
Init Types:
0: 20 second refresh of Market Data Only
1: 20 second refresh of Market Data & My Bets Data. Will call RefreshMyBets JS afterwards
2: On Demand My Bets and Market Data Refresh. Will *not* call RefreshMyBets after (in order to display confirmation screen)
3: On demand refresh of My Bets ONLY (No market refresh), will call RefreshMyBets
4: On Demand "Update" from My Bets Tab. Market Data (if bMarketWithMyBets set), and My Bets. Calls RefreshMyBets after. If bMarketWithMyBets is not set, just the My Bets data only
*/
switch(iInitType){
case 1:
if((bInEdit)||(sCurrentTab!="My")||(!bAutoRefreshMyBets)){iInitType=0;}
break;
case 3:
ResetRefresh();
sCurrentTab="My";
break;
case 4:
iInitType=(bMarketWithMyBets?1:3);
}
var sStamp = new Date();
var iEveID = (iSuperEventID==0?iEventID:iSuperEventID);
var sURL=sRefUrl+"?ei="+iEveID+"&typ="+sBetType+"&iid="+sInterfaceID+"&ts="+Date.parse(sStamp)+"&init="+iInitType+(bForceRefresh?"&fr=1":"")+"&sb="+(bIncludeSettledPL?"1":"0");
parent.Refresh.window.location.href=sURL;
}
The important part being in the bold. You could call the function every 20 secs, using DoRefresh(0). However, doing that means you need to code a function to call it every 20 secs. And unfortunately, web pages are re-rendered on every request, so the next request would effectively wipe out your custom timer function. IT may be possible by writing a html page on your desktop, that simply opens a new window, navigating to the site. And in the parent, use javascript to call the function of the child page every 20 secs.
Anyway, as you can see, there are alot of complicated things going on here. Basically, feeding everything about how the page is displayed to you, back to the server, so it knows where to reconstruct what you were looking at.
(ps, this function was found in BetMgr_AuxFunc_Shared.js, which exists about 5 folders deep from the main page. Simply navigate to the page, do a file...save web page... make sure its on complete, and save it to a new empty folder on your desktop. You will have all the data you need to do this. But it will take you at least two days or more... I would help, but have more important $$$ paying things to do...)
[edit] one more thing... the call back to the server in the above function stamps the current date and time... now, they may use that for determining what data you need... or, simply send you a cached version if it hasn't been longer than 20 secs, so be forewarned.
Last edited by nemaroller; Mar 31st, 2004 at 12:22 AM.
-
Mar 31st, 2004, 06:47 AM
#3
Thread Starter
New Member
Thanks a lot for the quick reply.
i have just quickly looked over your reply, but as it looks my boy is the Dorefresh(2); javascript function.
since that will refresh the data on demand.
how ever, i need to find a way to be able to execute that function within my webcontrol in visual basic. basically load the page in the browser and then have acces to the loaded functions and execute them. i do not know if its possible.
mayber there is a collection of javascripts?
like :
webbrowser1.document.javascripts.execute(dorefresh(2));
thanks in advance for helping me. ill try that websaving tonight when i get back from school.
phillipp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|