+ Reply to Thread
Results 1 to 1 of 1

VBA macro to get elements by Xpath from webpage without 3rd party tools?

  1. #1
    Registered User
    Join Date
    03-06-2014
    Location
    Center, Eastland
    MS-Off Ver
    Excel 365
    Posts
    15

    VBA macro to get elements by Xpath from webpage without 3rd party tools?

    Hi all,

    I know that Selenium has FindByXpath, but due to policy security reasons in the office, I cannot install or use exe files.

    My issue is that I want to get elements from a website using XPath expressions. I've found this nice function getXPathElement() that works with full xpath expressions, but I need to find elements by Xpath that contains some text.

    For example, if I want to get the element that contains the text HTML Editors from the url https://www.w3schools.com/html/, the full Xpath is
    Please Login or Register  to view this content.
    and one option of Xpath based on a text could be
    Please Login or Register  to view this content.
    With first Xpath, the function getXPathElement it works, but it fails with the second XPath. Is there a way to modify the function to accept not only full Xpaths? or is there another way to get elements by Xpath from web page without installing Selenium?


    This is my current code:

    Please Login or Register  to view this content.
    I've also tried the SelectNodes function but I get run-time error 13 in last command "Set elem = doc.SelectNodes(...)"

    Please Login or Register  to view this content.
    Thanks for any help.
    Last edited by Severduf; 05-14-2024 at 02:14 AM.

+ 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] Makro XML map elements | XPath run-time-error
    By Revnruno in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2023, 04:45 AM
  2. Replies: 5
    Last Post: 01-11-2022, 03:26 PM
  3. [SOLVED] Code for display bills details infront of Party Name line & separate column for party code
    By sbvaram in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-25-2021, 02:20 AM
  4. Need help building macro to autodial phone numbers using third party software
    By .jerm in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-29-2018, 04:23 PM
  5. [SOLVED] Excel IsNumber Function treats array elements differently from range elements
    By Alan Beban in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-31-2018, 02:22 PM
  6. Macro Codes to launch and run third party add-in
    By archrael in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2013, 06:24 PM
  7. Macro to validate third-party reporting
    By robevcas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2013, 02:37 PM

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