+ Reply to Thread
Results 1 to 44 of 44

How to know what inspect element wording to use with website dropdown

  1. #1
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    How to know what inspect element wording to use with website dropdown

    Hi All

    I am trying to automate client payments...The code below does all accept for two parts as depicted as Part1 and Part2
    Please Login or Register  to view this content.
    The below images are the inspect element view of the specific elements needed for Part1 & Part2
    Last edited by sintek; 02-12-2018 at 01:56 PM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website click

    ............deleted....................
    Last edited by sintek; 02-12-2018 at 10:05 AM.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website vba

    Hi All

    I have reopened this thread as I need help with specific inspect element extraction...

    Okay, so I found the code to press pay....
    Please Login or Register  to view this content.
    Last edited by sintek; 02-12-2018 at 12:02 PM.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website vba

    Any ideas what code I can use to select the first option of the dropdown box
    .
    Please Login or Register  to view this content.
    Last edited by sintek; 02-12-2018 at 01:30 PM.

  5. #5
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,260

    Re: How to know what inspect element wording to use with website vba

    Use as colection because so many choice
    Like in sheets
    For each sh in sheets
    Also in dropdown
    Please Login or Register  to view this content.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    Hi daboho

    Thanks for response...Am getting an error 438, object does not support this property or method

  7. #7
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,260

    Re: How to know what inspect element wording to use with website dropdown

    I am not test but if you
    Want select dropdown in web
    And dropdown object is as colection
    You must to add reference tool
    Xml html and xml

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    Am I using the correct extraction from inspect element as per image above in post 1...References have been added
    Please Login or Register  to view this content.

  9. #9
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    FYI - getElemnt(s)byxxx has some quirks if reference to the library (HTML Object) isn't added.

    In many cases only reliable method without reference is to access by TagName or ID.

    As for selecting from drop down. You can loop through length of object and check instr for value you are after.
    However, in most cases, you'd not set the value, but set selected = true.

    Ex:
    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,260

    Re: How to know what inspect element wording to use with website dropdown

    I am not understand what you want
    My english is bad but propertis in dropdown or other object same as like in sheet

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    My question is as follows....
    With this code
    Please Login or Register  to view this content.
    looking at the HTML code of the dropbox in post 1...What goes in place of the red part above...

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    @CK76 Thanks for your response...Same error 438

  13. #13
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,260

    Re: How to know what inspect element wording to use with website dropdown

    Yes i am agree
    But if still using loop
    Can do using UDF for eficiency
    And if you want loop
    Dim op as object
    Dim op1 as new ihtmlelementcollection
    set op =....getelementsbyclassname("blababa")
    Set op1= op.getElementsbyID("blababa")(0)
    And loop op1

  14. #14
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    From the screen shot you provided, try "fromAccount_dropID".

    But it's difficult to pinpoint the control needed without seeing site in action. Since there could be more than one drop down and often, there is script associated to dropdown selection.

    In that case, you'll need another line to fire the script.

    Typically something like below to fire JS event.
    Please Login or Register  to view this content.

  15. #15
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    There is only 1 dropdown...I have ticked the reference HTML library...
    Errors on this line...
    Please Login or Register  to view this content.
    Dropdown has choice of "Business Account" or "Personal Account"
    Last edited by sintek; 02-12-2018 at 02:50 PM.

  16. #16
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    From your screenshot, "fromAccount_parent" is a wrapper and not the dropdown itself.

    Try either "fromAccount" or "fromAccount_dropID".

    0.JPG

  17. #17
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    @ CK76 tried both options....still errors, now on red line of code
    Please Login or Register  to view this content.

  18. #18
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,260

    Re: How to know what inspect element wording to use with website dropdown

    After id has matches
    Try this
    Please Login or Register  to view this content.

  19. #19
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    What's the error message and what value does obj.Length return?

  20. #20
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    @CK76...
    Error 438, object does not support this property or method ...
    No values returned..errors prior

    @ daboho...
    I do not understand...What do i replace the red part with
    Please Login or Register  to view this content.
    Edit...i feel like i felt 2 years ago when I had no clue how to use excel...A complete newbie...
    This is current code...
    Please Login or Register  to view this content.
    Last edited by sintek; 02-12-2018 at 03:09 PM.

  21. #21
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,260

    Re: How to know what inspect element wording to use with website dropdown

    I think your problem is
    How to find correct id
    I think you easy to use HTTPRequest
    And download add on for google ( i am forget is name)
    To record like record makro
    This add on can do search what you want

  22. #22
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    I clicked on the dropdown and this is the code for the options...Will this help?

    Untitled.png

  23. #23
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    daboha & CK76...Thanks for your patience..
    Got it working with the following code:
    Please Login or Register  to view this content.

  24. #24
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    So try looping through <li> tag or using class "dropdown-item clearfix".

    But as previously stated, it's pretty difficult to trouble shoot web scraping code, especially when you are piloting browser, without actually seeing site in action to trace everything that goes on a given site.

    Edit: Glad you got it working

  25. #25
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    Guys....Surely it can't be this difficult to grasp....
    Herewith image of logout button HTml

    Once again...I have tried everything and can't get the logoff button to click...
    I mean really!!!!!!

    logout html.png

  26. #26
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    You'd either access it by ClassName or TagName.

    ex.
    Please Login or Register  to view this content.
    Note that since both are ElementsCollection, you'd need to specify index#.

  27. #27
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    And back to same error message with both options...Error 438, object does not support this property or method ...

    Darn it CK76...why can't I wrap my head around this stuff...


    Edit...
    I stand corrected ....This does work...I did not have application.wait code in place for screen to finish loading...
    Please Login or Register  to view this content.
    thanks CK76....Any helpful links you know of thatIcan study...why the (0)
    Last edited by sintek; 02-13-2018 at 11:21 AM.

  28. #28
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    Web scraping is learning how to read developer tools and html source code. Has very little to do with VBA knowledge, once you get the basic DOM structure.

    Try instead of using Inspect Element, see if you can locate the button in the source code.

    Since every site has it's own style and structure, it's largely trial and error. With experience, you get better at spotting the right element to access info/action needed.

    Edit: Glad, you got it working. (0) is first item in Element Collection. It's standard method to access first element in array/collection.

    Edit2: .getElementsByClassName as the method name suggest, returns elements, hence the need to specify which element you are interacting with.
    Last edited by CK76; 02-13-2018 at 11:28 AM.

  29. #29
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    Got it...Time for google lol...Thanks again CK76

  30. #30
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    CK76...last one...I promise....Such a lot of variations within the HTML code
    Untitled.png

  31. #31
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    This is <a> tag (i.e. Hyperlink).

    But, has code that fires onclick. Try something like below to fire script without need to simulate click on element.

    Please Login or Register  to view this content.
    Replace "fnb...; return false;" part with full string in quote after onclick=.

    If that does not work, you'll need to .getElementsbyTagName("a") and set it to some object variable. Then loop through the collection and identify if href has "#" as it's value. If it does, you can fire script using .FireEvent on object.

    Ex:
    Please Login or Register  to view this content.
    Note that this is provided there are no other <a> tag with href="#".

    Edit: Alternately you can check objHL.innerText = "Confirm" (or use INSTR function).

    Edit2: Forgot to add index to objHL. Updated code
    Last edited by CK76; 02-13-2018 at 01:55 PM. Reason: See Edit2:

  32. #32
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    k tx will try and advise...

  33. #33
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    Have tried all three suggestions and error 438 occurs... This is the last step in my code that has taken 3 days lol...

  34. #34
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    I forgot to add (i) to objHL. Try it with that.

  35. #35
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    Tx ... Have used following and when i = 2 it returns "Confirm", however, it bypasses the FireEvent

    Please Login or Register  to view this content.
    Last edited by sintek; 02-13-2018 at 02:29 PM.

  36. #36
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    Hmm, then try just simulating click and see what happens.

    Please Login or Register  to view this content.

  37. #37
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    That was the first thing I tried...So close yet so far.....

  38. #38
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    Okay, there was a trailing space in "Confirm ", so it now returns true but the
    Please Login or Register  to view this content.
    does nothing

  39. #39
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    Hmm, if you can upload full source html for the page (as text file), it may help. I have suspicion that there may be more than one .innerText = "confirm".

  40. #40
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    How would I do that...

  41. #41
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    This is tricky stuff man.....This solves ....
    Please Login or Register  to view this content.

  42. #42
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    So there's some nested (child) element within the obj that you are looping through.

    For web scraping, understanding HTML structure along with few other things is more important than knowing VBA

    I'd recommend going over W3School's documentation.

  43. #43
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: How to know what inspect element wording to use with website dropdown

    will do...Tx again

  44. #44
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to know what inspect element wording to use with website dropdown

    FYI - Here's code that I use to export Document.Body.innerHTML to text file.

    Assuming you've already navigated to the page that you need and set IE object.

    Please Login or Register  to view this content.

+ 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. 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
  2. Website Script to click button on Website and export file to directory?
    By stangz71 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2017, 03:55 PM
  3. Replies: 25
    Last Post: 06-10-2016, 10:17 AM
  4. Replies: 2
    Last Post: 05-18-2013, 02:31 PM
  5. Inspect document and delete hidden rows with VBA
    By sabutler4 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2013, 04:51 PM
  6. Get element from website problem
    By ckjason in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-02-2012, 01:00 AM
  7. How to get the value of a hidden element from a form that is on a remote website?
    By excel-yes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2012, 07:15 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