Element Child
From UBot Studio
(Difference between revisions)
(Created page with "$Element Child is a Browser Function. This function returns the child of a selected element. == Example ==") |
(→Example) |
||
Line 5: | Line 5: | ||
== Example == | == Example == | ||
+ | |||
+ | <pre> | ||
+ | navigate("http://ubotstudio.com/resources", "Wait") | ||
+ | set(#logo, $scrape attribute($element child(<href="http://www.ubotstudio.com/index2">), "src"), "Global") | ||
+ | set(#sales questions, $scrape attribute($element sibling($element sibling(<innertext="Sales Questions">)), "innertext"), "Global") | ||
+ | </pre> | ||
+ | |||
+ | $element child gets the child html element of the one matched with the selector | ||
+ | $element sibling gets the element directly next to the one matched | ||
+ | $element sibling can return #text elements, which can be just whitespace between two tags | ||
+ | For the example | ||
+ | |||
+ | <pre> | ||
+ | <b>hello</b> <b>hi</b> | ||
+ | </pre> | ||
+ | |||
+ | The element sibling to the first <b> would be a #text element | ||
+ | which just contains " " which is the blank space between "hello" and "hi" |
Revision as of 23:04, 5 December 2012
$Element Child is a Browser Function.
This function returns the child of a selected element.
Example
navigate("http://ubotstudio.com/resources", "Wait") set(#logo, $scrape attribute($element child(<href="http://www.ubotstudio.com/index2">), "src"), "Global") set(#sales questions, $scrape attribute($element sibling($element sibling(<innertext="Sales Questions">)), "innertext"), "Global")
$element child gets the child html element of the one matched with the selector $element sibling gets the element directly next to the one matched $element sibling can return #text elements, which can be just whitespace between two tags For the example
<b>hello</b> <b>hi</b>
The element sibling to the first would be a #text element which just contains " " which is the blank space between "hello" and "hi"