View Single Post
  #8  
Old 11th February 2014, 02:16 AM
walkermac walkermac is offline
Member
 
Join Date: Nov 2013
Posts: 603
Default

Heya,

Since it works fine with an invalid username/password pair, I presume that a successful login alters the contents of the betting area (if not the actual layout, then the name/address of items on the page). Unfortunately it won't let me create an account so that I can check whether this is the case.

So, you have 2 options.

1. - Run the code while you're logged out and put a bogus username/password pair in your spreadsheet. This is what I can test and I can see that it works (at least until they change their code). It selects Win bet, it clicks on the horse checkbox (so long as it is running), and fills in the bet amount. When you click on the Submit Bet button manually, it gives you the opportunity to login, etc. Make your bet and click Log out afterwards. Not such a terrible way of doing things as it's probably not a good idea to leave a plaintext copy of your login details of your tab account lying around.

2. - I've commentated my code pretty heavily and explained how I was able to determine the names of items on the screen. Time for you to flap those wings and fly! Log in to the NZ TAB site using the Google Chrome browser (it's easier) then right-click on the items you want to manipulate and select Inspect Element from the resulting pop-up menu. Then update the code to refer to the "name" parameter of these items instead of the existing ones (again, this is presuming that the names change dependent on whether the user is in a logged in or logged out state - if this isn't the case then I don't know how to fix it for you anyway! )


Incidentally, after "horseSelection.click" in the code, add the following to click the Submit Bet button:

i = 0

While i < htmldoc.Links.Length

If htmldoc.Links(i).innerText = "Submit bet" Then
htmldoc.Links(i).Click
i = htmldoc.Links.Length
End If

i = i + 1
Wend

I'm positive I tried the exact same thing before but, with the javascript running it's a dynamic environment. Perhaps I tried it earlier than I should have - or I just made a typo or something.

Anywho, all that should be enough to get you over the line. Good luck!


...is what I wrote first.

But I couldn't leave it alone. Try changing all occurences of "htmldoc.forms(0).elements" to "htmldoc.forms(1).elements". It looks like the stuff we want to update is on forms(0) if we have made an unsuccessful login, and on forms(1) if we are yet to log in! Maybe it's the same for a successful login. Just keep incrementing that figure until it complains about it, I guess
Reply With Quote