Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Iterate through Elements of Page
#1
I am trying to locate an element based on a given tag, attribute and value. What's the best way to do this using VB6? Is this Possible? Thanks

Code:
    tag = "span";
    attr = "innerhtml";
    value = "^" + project.Variables["facebookPageName"].Value.Replace(" ","\\ ");
    searchType = "regexp";
    findStr = "input:radio"
    
    // Find Correct Page Element
    
    HtmlElementCollection results = instance.ActiveTab.FindElementsByAttribute(tag, attr, value, searchType);
    foreach (HtmlElement res in results)
        
    {
        
        if (res.ParentElement.PreviousSibling.FirstChild.FirstChild.GetAttribute("fullTag")  == findStr )
        
        {
            project.SendInfoToLog("Element Found " + res.InnerText);
        }    
        
    }
Reply
#2
Hi Maddire,

You would do it the way you're showing, by running javascript from VB6 and then returning the result to VB6.
An example of that is in the OnTimer sub of the Exchange Rates example.

Alternatively you can use ExecuteScript too of course.

There is no way to do this directly from VB6 itself.
--
Wil
Reply
#3
(2024-01-08, 10:57:48)wila Wrote: Hi Maddire,

You would do it the way you're showing, by running javascript from VB6 and then returning the result to VB6.
An example of that is in the OnTimer sub of the Exchange Rates example.

Alternatively you can use ExecuteScript too of course.

There is no way to do this directly from VB6 itself.
--
Wil

Ok Thank you, I will try this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)