+ Reply to Thread
Results 1 to 9 of 9

Web Scraping - how to trigger what I believe may be javascripti

  1. #1
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Web Scraping - how to trigger what I believe may be javascripti

    First of all, since it is a VBA task, I took a chance posting here. That said, I know it is not purely a VBA request.

    I've been trying to avoid IE automation for other tasks in the project, but suppose in this case I probably will need to invoke IE since I need to "click" on some items.
    I'm trying to extract data from a web page, which I THINK I'll be able to accomplish, but what I can't seem to do is find a way to trigger clicking on certain items. The page is "https://lpf.ro/liga-1"
    You will see near the top there are "buttons" numbered 1 to 30, which will change the contents of the page based on that given stage in a soccer season. I just need to find a way to activate those so I can cycle through the stages.
    Thank you in advance for any help you could provide on this.

    Arkadi
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  2. #2
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,134

    Re: Web Scraping - how to trigger what I believe may be javascripti

    @Arkadi, try something like this ... (For the button "12")

    Please Login or Register  to view this content.
    Last edited by Haluk; 10-07-2020 at 05:45 PM.

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Web Scraping - how to trigger what I believe may be javascripti

    Nice Haluk! Thanks for that! Works like a charm.

  4. #4
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,134

    Re: Web Scraping - how to trigger what I believe may be javascripti

    You're welcome...

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

    Re: Web Scraping - how to trigger what I believe may be javascripti

    AS far as I can see, you don't need to use IE for this, what information are you actually after on the page?

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Web Scraping - how to trigger what I believe may be javascripti

    Hi Kyle, thanks for replying, and sorry to take so long to get back to you.

    The list of matches, and their scores. Or "-" if the round hasn't been played yet. I'm actually having some issues with that because it seems the structure of the tables I'm trying to read changes when the match isn't played yet. I'm also looking not for the team name as listed on the screen, but in the page there is a Title value of the third childnode of the cell (when it is the team name).

    For example, in stage 1, the first match would be read as "FC ARGES - FC BOTOSANI", which I place in row 1 of a sheet. Then in the same column, row 2, I want to place the outcome (2-3).

  7. #7
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,134

    Re: Web Scraping - how to trigger what I believe may be javascripti

    @Arkadi;

    You can check if the "Selected" one is "Current" or not, so that you can decide on the structure of the page.

    You may try the below code to see the "Selected" and the "Current" etapa values.

    Please Login or Register  to view this content.

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

    Re: Web Scraping - how to trigger what I believe may be javascripti

    Sorry for the delay, I'm going to assume you can deal with putting this on the sheet in the format you want, the trick is to just make the same web request that the page makes when you click a button and skip trying to "click" the button at all.

    Please Login or Register  to view this content.
    Last edited by Kyle123; 10-15-2020 at 11:26 AM.

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Web Scraping - how to trigger what I believe may be javascripti

    That's great Kyle123, thanks very much to you both for the input. I'm pretty comfortable in VBA but rarely do anything with the web. I'm going to dump the results into an array and after each stage put it on my sheet.

+ 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. [SOLVED] Web scraping using VBA
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 07-21-2020, 01:42 AM
  2. [SOLVED] VBA Web Scraping
    By dddddmex in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-13-2020, 11:36 AM
  3. Web Scraping
    By CheekyMonkeh in forum Excel General
    Replies: 1
    Last Post: 10-15-2018, 02:43 PM
  4. Web scraping help
    By dvnr_76 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2016, 03:55 AM
  5. Web scraping
    By vijay.jp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-02-2015, 12:56 AM
  6. Adjust a code from cell range trigger to button trigger
    By ld2x07 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2014, 10:02 AM
  7. [SOLVED] Web scraping with xml
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-24-2012, 05:25 AM

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