+ Reply to Thread
Results 1 to 21 of 21

AFL Stats, Manipulating Dropdown Boxes, fireEvent

  1. #1
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Hi everyone,

    I haven't done much VBA interaction with IE and am doing this to learn as much as I can. So any help/tips or tricks/better ways to do this would be greatly appreciated. I have already spend a huge amount of time getting to where I am now and am using Excel Forum as a last resource, so I'm sincerely asking for help.



    Please see the following website: http://www.afl.com.au/stats

    Problem 1: I am able to get vba to select "SEASON" from the dropdown boxes But the data stays the same (very wrong). I think I am missing an .fireEvent or run Function? or a "reload"?
    Problem 2: I an unable to find any unique IDs for selecting "ROUND", So I am unable to manipulate this for TEAMS or PLAYERS. (I haven't a clue how to work around this)
    Problem 3: Once I am able to manipulate "SEASON", "PLAYERS" and "ROUND", I am interested in manipulating "Advanced Options" (I haven't looked at this yet)
    Problem 4: After "Advanced Options" I want to extract the data to excel. (I haven't looked at this yet)


    Please Login or Register  to view this content.
    Edit:
    I have also also linked the question to stackoverflow http://stackoverflow.com/questions/4...28831_43177027


    Thanks guys!

    Jimmy
    Last edited by JimmyWilliams; 04-03-2017 at 12:06 PM.

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Hi Jimmy,

    I can't help with IE etc., but I suspect you'll find that the AFL is very proprietary about their statistics, and doesn't allow access to us, the general public.

    I hope I am proven wrong - I will watch this thread with interest.

    Regards,

    David

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    OP updated posf
    Last edited by Kyle123; 04-04-2017 at 02:25 AM.

  4. #4
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Hey Kyle,

    Thanks for the reminder. Just keen to get help on this problem.

  5. #5
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Actually, all the stats are available on the website. they're just displayed very poorly.

    I am more interested in using this as a way to practice and learn more about how to manipulate IE. So i really need someone to show me better methods/ how to get the job done.

    Regards,
    Jimmy

  6. #6
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Bumping this thread.

  7. #7
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    * BUMP * anyone ?? please help thank you.

  8. #8
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    * BUMP * anyone ?? please help thank you.

  9. #9
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Quote Originally Posted by Kyle123 View Post
    OP updated posf
    * BUMP * anyone ?? please help thank you.

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Quote Originally Posted by JimmyWilliams View Post
    Actually, all the stats are available on the website. they're just displayed very poorly.
    I am more interested in using this as a way to practice and learn more about how to manipulate IE. So i really need someone to show me better methods/ how to get the job done.
    i think David is right in this case
    while websites like this offer the information freely on their site, they do not people to scrap their sites without actually visiting the website
    it would how they justify the success of the website as well as collect ad revenue
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  11. #11
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Quote Originally Posted by humdingaling View Post
    i think David is right in this case
    while websites like this offer the information freely on their site, they do not people to scrap their sites without actually visiting the website
    it would how they justify the success of the website as well as collect ad revenue
    Hi David,

    Think of this more as a learning experience, I want to develop these skills but am at an impasse and am not sure how to proceed. I want to be able to extract the data and manipulate it all in a single button, because once I am able to do that, I could re-apply the same in other places.

    I have had some people tell me to learn java or python for web scrapping. Do you have any opinion on this, should I continue trying it with VBA or start with a different language and then try to have it exported into excel?

    Thanks
    Jimmy.

  12. #12
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Excel is NOT the best tool for the job, quick google can you will get sense and feel of what is

    my personal opinion is that Web scrapping (or whatever you want to call it) generally is against most websites T&C's
    if i was a website owner i would want people to visit my actual front page instead of trying to just go in the backdoor and take everything i have on offer

    however this isn't going to stop people trying to do it

  13. #13
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Hmm, I don't think excel is a particularly bad tool for it. It's certainly the easiest to learn if you're wanting something quick. Just read the terms and conditions of the site before scraping - you'll find that many sites that have data worthy of scraping also offer and api. Always use this wherever possible (though this isn't scraping) as you aren't at the mercy of html changes.

    If you really want to get into scraping you need to learn 2 things, html and how http requests are formed. Forget trying to automate IE, it's never necessary and very slow.

  14. #14
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Quote Originally Posted by JimmyWilliams View Post
    I have had some people tell me to learn java or python for web scrapping. Do you have any opinion on this, should I continue trying it with VBA or start with a different language and then try to have it exported into excel?
    I would defenitely opt for python for web-scraping. It's easy and fun to learn the language, especially if you have some programming background
    If you are pleased with a member's answer then use the Star icon to rate it.

  15. #15
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Hi JimmyWilliams,
    I am not quite experienced enough to get you started as I have only moderate VBA skills and an initial bit of experience with web scrapping.
    But some general comments that might be of interest to you……

    I started learning Excel a couple of years back for a personal project that included getting a lot of data for the nutritional values of food products. I needed to have this either_..........
    _ into permanently
    or
    _ quickly accessible, that is to say, temporarily, into,
    _.........a main large file.

    The info came anywhere and everywhere from typing in manually what was on products labels to getting info from lots of different web sites, commercial, research, academic… etc… etc…

    I made two big mistakes:
    _1 Not learning VBA earlier. This is because some things that are very difficult and memory eating with formulas are ridiculously easy with a few simple lines of code.
    _2 I did not get , and get a good understanding of, a scrapping code earlier for one of the free info giving sites that I often used. …...I made a lot of formulas and code to try to get the data I wanted into the form I wanted after I had done a simple manual copy and paste of bits of info from the web site.

    Then ,eventually, I did make a start at “scrapping” myself, and also, like you, went initially, the “IE.navigate” way. I soon moved on to the “Back door HTML request way” after some initial great help from Leith Ross ( https://www.mrexcel.com/forum/excel-...cations-2.html )

    I have older computer and operating system, some use Internet explorers 7 - 9 which either don’t work any more on most things or take ages. Some “IE.navigate” things don’t seem to work anymore for me either.- … but….. Never the less, - the Back door HTML request way code I have/ had worked still at the speed of light on computers and systems that barely manage to do anything else much anymore… other than die….

    I had to revisit / rewrite the code after I got caught out last year by a change in the Website HTML source code. https://www.excelforum.com/excel-pro...te-change.html

    I got some great help not only on modifying my code , but , more importantly in my opinion, on actually understanding fully the code, ( some chap Kyle I seem to remember …. :-) )
    https://www.excelforum.com/excel-pro...ml#post4439005
    http://www.excelforum.com/showthread...t=#post4446317
    https://www.excelforum.com/developme...ed-please.html
    ‘EP: https://www.excelforum.com/developme...ml#post4450773


    I finally came up with, what is for me, just about my favourite code now: https://www.excelforum.com/developme...ml#post4449914
    https://www.excelforum.com/developme...ml#post4449690


    The speed is so fast, that rather than store all the info that is available freely from that particular site, I access it “real time / instant stylio” when I need it based on a closed workbook reference pseudo intellisense search of the product name in the first column stored “pseudo XML like” ..……( https://www.excelforum.com/excel-pro...ml#post4673161 )

    But, just now, I cant get much Internet access for a while. Last night I had a chance for a few hours. So, I took my basic final scrapping code from above, turned it into a “Pseudo” Function – (
    Sub GetNutsEP(ByVal URL As String, ByRef arrdbHds() As Variant, ByRef arrdbVls() As Variant) in the attached file ). I made another function again based on the same great help from before, Sub GetdebinetLinks( , along with a few simple code lines in a couple of routines, Sub GermanLinks() , Sub FilldebinetG2().
    Last night while I still had internet, I set off Sub FilldebinetG2() , then went to bed. When I went to the Toilet later, the code was already finished. The results are in worksheet “debinetG2” of the uploaded file, which also has those last few codes in it. ( The codes are all actually quite short and compact, they just look long due to all the ‘Comments in them. )

    It was quite a life saver. And amazingly simple to get all that info. I finally have about 35000 rows of info each row with about 150 Nutrient values columns: … To compare – I often needed a week or more each, to get between a few 100 to a few thousand rows of such info with much less number of column per row info in a simple table form similar to the one that my computer gave last night in a few hours on its own while I slept.
    It would have taken me without web scraping, I expect months to get all that info one way or another.
    I am very grateful to have got all that info, so quickly , in one go, as a back up to use now.

    After getting all this info from the site I scrapped, I am encouraged to go more often to main site, look at what is to offer etc, try our stuff maybe etc.. etc... I think often when a free version of something works well you are more likely to consider them for a paid upgrade or something else or recommend them further.
    I am not sure if the HTML back door request way is not registered by the site as a visit/view ?? I do not know if you are seen , or incognito?? It would be a shame if they made such site difficult to scrap. I expect it would not be too difficult to mess a source code up a bit to make it difficult to scrap. Some sites I wanted to scrap seemed to have the whole site in some continuous string so I could not see how I would do the “HTMLdoc.getElementsByTag___” stuff to work. The “HTMLdoc.getElementsByTag___” is one of the key things to get sets of what you want

    Bottom line , is,
    Quote Originally Posted by JimmyWilliams View Post
    ....this more as a learning experience, I want to develop these skills but am at an impasse and am not sure how to proceed. I want to be able to extract the data and manipulate it all in a single button, because once I am able to do that, I could re-apply the same in other places......
    my advice, go into Google Chrome, get your web site up, right click and select “view source code”. Copy it to a simple text File, or preferably Notepad ++ . If you can, get a hard copy of it.
    Study it. Read up or check out Threads scrapping with the Back door HTML request way
    Have a go at writing a code , at least as far as getting your .responseText and creating your HTML Document object from it.
    Then see if you can get help to get you further.

    Alan.

    P.s.
    As for API. ?? I seem to see that recommended a lot. I never see any explanation of how to actually use one or “it”. Seems like a blind way of doing something and relying on someone to have done something so that “it” always works even if the HTML changes in a site. I couldn’t find anyone who really knew what “it” was in as much detail to actually use ”it” or make one of “it” ???.
    I think ideally if you get a good scrapping code that you understand, then either alone or with some help you will be able to modify your scrapping code appropriately. With hind site it was incredibly easy and obvious to change my code when a site change caught me out , but as I did not really understand fully my code initially, it was very difficult.
    Thanks to some great help here I have that well sussed now



    File : “debinet.xlsb” https://app.box.com/s/drc8tv66yktse4dspbx24pzb854rqdfv
    Last edited by Doc.AElstein; 06-15-2017 at 07:17 AM.
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

  16. #16
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Quote Originally Posted by Doc.AElstein View Post
    Hi JimmyWilliams,
    ....
    Woah, lots of information. Its going to take me a bit of time to process it all. But thanks in the meantime!

    Jimmy

  17. #17
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    I'm not trying to do anything wrong.

    They provide the information, its just displayed Very poorly. I want to be able to experiment with some of the numbers. And just experiment in how to make the process overall cleaner.

    However, I do understand where you're coming from.

  18. #18
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,219

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Hi Jimmy,

    Using 2016 and Data -> Web, I can pull down this data. Power Query or Get & Transform is a lot more powerful in newer versions of Excel. Is this what you wanted?

    PQ Load Table 0.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  19. #19
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Hi Jimmy,
    Quote Originally Posted by JimmyWilliams View Post
    ..thanks in the meantime!
    Yous welcome, thanks for the feedback.
    Good luck
    Alan

    EDIT: Thanks for the Rep
    Last edited by Doc.AElstein; 08-18-2017 at 03:02 AM.

  20. #20
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Quote Originally Posted by buran View Post
    I would defenitely opt for python for web-scraping. It's easy and fun to learn the language, especially if you have some programming background
    Alright, I'll try learning python and come back to this post (may be an extended period of time before I am able to continue this post).
    Thanks guys

  21. #21
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: AFL Stats, Manipulating Dropdown Boxes, fireEvent

    Quote Originally Posted by JimmyWilliams View Post
    ...I'll try learning python ..
    Hi Jimmy,
    Just incase you did not catch these Threads on Python..
    https://www.excelforum.com/the-water...-in-excel.html
    https://www.excelforum.com/the-water...thon-tips.html
    Alan

    I was thinking of having a quick look at Python myself, later when the snow comes...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Graph to show individual Stats as compared to the population stats
    By Kellbells in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-12-2015, 10:36 AM
  2. Dropdown Boxes
    By NadiaY in forum Excel General
    Replies: 1
    Last Post: 10-07-2014, 08:15 AM
  3. Manipulating Dropdown List in IE using VBA & Form Submit oddities
    By JScottArnold in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-30-2013, 05:43 PM
  4. Manipulating check boxes en masse
    By martix in forum Excel General
    Replies: 3
    Last Post: 01-13-2013, 12:38 PM
  5. Manipulating boxes
    By butertf in forum Excel General
    Replies: 2
    Last Post: 06-24-2009, 11:15 AM
  6. Dropdown boxes
    By Tony McGuire in forum Excel General
    Replies: 5
    Last Post: 04-21-2009, 03:09 PM
  7. Dropdown boxes!
    By Rubes in forum Excel General
    Replies: 2
    Last Post: 04-16-2009, 10:02 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1