|
|
|
|
|
<htmlDocument variable>.FindElementByClass (Function) In french: <Variable htmlDocument>.ChercheElémentParClasse Searches for elements whose "class" attribute matches a specific value in an HTML document. d is htmlDocument = HTMLOuvre("https://www.pcsoft.fr", fromURL)
e is array of htmlNode <- d.ChercheElémentParClasse("Red")
Syntax
<Result> = <Element to handle>.FindElementByClass(<Sought Class attribute>)
<Result>: Array Array of htmlNode elements that match the search condition. <Element to handle>: htmlDocument variable Name of the htmlDocument variable in which the search will be performed. <Sought Class attribute>: Character string Value of the "Class" attribute to be searched for. Remarks <htmlDocument variable>.FindElementByClass 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 = d.ChercheElémentParClasse("ab")
FOR EACH x OF t
Trace(x:id)
END
Trace("-- cd")
t = d.ChercheElémentParClasse("cd")
FOR EACH x OF t
Trace(x:id)
END
Trace("-- ab cd")
t = d.HTMLChercheElémentParClasse("ab cd")
FOR EACH x OF t
Trace(x:id)
END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|