+ Reply to Thread
Results 1 to 10 of 10

Web Scraping - find element to click

  1. #1
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    Web Scraping - find element to click

    Hello. I'm trying to automate a report that starts with opening a web page. Using IE, I'm so far able to sign on and do several 'clicks' to get to the page displayed. The page displayed has an image/icon (not a button) on it that I then need to click to get to the next page. I've tried everything I can think of but I cannot find the clickable element on this last page displayed. As a note, I believe the last click I successfully did caused a redirection to another web site (my logon was automatic to this website) that contains the page displayed. I've attached the html that appears when I inspect the image/icon that I want to click on the last page displayed.

    I want to be able to click on the image/icon that contains the text 'My Reports'.
    I hope I have explained this enough and hope someone can help.
    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    Re: Web Scraping - find element to click

    Anybody? I'm kind of stuck here. Thanks.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Web Scraping - find element to click

    Hi,

    as without any URL neither a good enough explanation with details and neither the entire webpage code
    so this is just some mind readers challenge …

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Web Scraping - find element to click


    If at least you have shared your code attempt …

    So in your code, you can try to check all elements with the same class for the one containing the expected text
    then once found you can click on its parent.

  5. #5
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    Re: Web Scraping - find element to click

    Thanks. Here's example of code I'm using. I've tried different classNames but they are never found in the script. I've also attached portion of page source that I think applies. I want to click on the item that contains the text 'My Reports'.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Web Scraping - find element to click


    Did you try the class of the element to click ?

    Or the class of its parent as this class seems unique in your part of codepage ?

  7. #7
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    Re: Web Scraping - find element to click

    I've tried a lot, but I just don't yet understand script constructs. Trying to figure out 'byclassname', tagname', id, span, etc. Can you suggest something I might try given the page source provided? Thanks.

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Web Scraping - find element to click


    A lot means nothing on my side as I won't guess anything !

    So the first class to try is obviously 'mstrLink' according to your poor page source …

  9. #9
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    Re: Web Scraping - find element to click

    Tried that one and others that seemed likely, but none found. Is there a way, with VBA, to Debug.Print every 'ClassName' in the page source, and their inner text, if any? When I finally land on this page, I think I've been redirected to another web site using the same login credentials as the original login. Could that be the reason I'm not finding any 'ClassName's? Thanks.

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Web Scraping - find element to click


    Two points :

    1. synchronization issue : the webpage is not fully loaded when the code attempts to reach elements by class
      so you must add a pause in the code to be sure all elements are enable …

    2. The webpage is more complex than the poor part you have shared so impossible mission to find out any way …

+ 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. Web Scraping - MouseEvent vs Click?
    By nobodyukno in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2019, 01:11 PM
  2. what is the vba code referring given inspecting element - to click go
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-16-2019, 06:39 PM
  3. Unable to click Submit Button_Web Scraping
    By Rajkumar_h in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-22-2019, 01:57 PM
  4. Right-click on file and click element
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-10-2017, 10:07 AM
  5. Get element by value? [click on option button on web page]
    By emjay973 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-10-2017, 05:52 PM
  6. could not get last element while looping through class name (web scraping)
    By shiva_raj in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-18-2017, 08:15 PM
  7. Double click on element in dynamically defined chart
    By padleywoods in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-07-2012, 01:54 PM

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