Antwise community forums
Iterate through Elements of Page - Printable Version

+- Antwise community forums (https://forums.antwise.com)
+-- Forum: Antview (https://forums.antwise.com/forumdisplay.php?fid=11)
+--- Forum: Antview for Windows (https://forums.antwise.com/forumdisplay.php?fid=12)
+--- Thread: Iterate through Elements of Page (/showthread.php?tid=180)



Iterate through Elements of Page - maddire - 2024-01-06

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);
        }    
        
    }



RE: Iterate through Elements of Page - wila - 2024-01-08

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


RE: Iterate through Elements of Page - maddire - 2024-01-08

(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