PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Searches for elements whose "class" attribute matches a specific value in an HTML document (or in an HTML node).
Example
d is htmlDocument = HTMLOpen("https://www.windev.com", fromURL)
e is array of htmlNode <- HTMLFindElementByClass(d, "Red")
Syntax
<Result> = HTMLFindElementByClass(<Element to use> , <Sought Class attribute>)
<Result>: Array
Array of htmlNode elements that match the search condition.
<Element to use>: htmlDocument or htmlNode variable
Element where the search will be performed:
<Sought Class attribute>: Character string
Value of the "Class" attribute to be searched for.
Remarks
HTMLFindElementByClass respects the rules for "selecting" HTML elements according to their class(es):
  • search for the different classes separated by spaces; all the requested classes must be present ("AND" search).
  • case-sensitive search (generally, classes are in lowercase characters).
  • search ignoring duplicates.
Example:
d is htmlDocument
 
d.html.body.span[1]:id = "1"
d.html.body.span[1]:class = "ab"
 
d.html.body.span[2]:id = "2"
d.html.body.span[2]:class = "ab cd"
 
d.html.body.span[3]:id = "3"
d.html.body.span[3]:class = "cd"
 
d.html.body.span[4]:id = "4"
d.html.body.span[4]:class = "ab cd ab"
 
t is array of htmlNode
 
Trace("-- ab")
t = HTMLFindElementByClass(d, "ab")
FOR EACH x OF t
Trace(x:id)
END
 
Trace("-- cd")
t = HTMLFindElementByClass(d, "cd")
FOR EACH x OF t
Trace(x:id)
END
 
Trace("-- ab cd")
t = HTMLFindElementByClass(d, "ab cd")
FOR EACH x OF t
Trace(x:id)
END
Component: wd270html.dll
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment