Element Sibling
From UBot Studio
(Difference between revisions)
Line 12: | Line 12: | ||
<pre> | <pre> | ||
− | + | load html("<html> | |
− | + | ||
− | </ | + | <head> |
+ | <title>DOM Tutorial</title> | ||
+ | </head> | ||
− | + | ||
+ | <body> | ||
+ | <h1>DOM Lesson one</h1> | ||
+ | <p>Hello world!</p> | ||
+ | </body> | ||
− | + | </html>") | |
− | + | set(#sibling, $scrape attribute($element sibling($element sibling(<tagname="h1">)), "innertext"), "Global") | |
− | + | ||
− | + | ||
− | + | ||
− | < | + | |
− | < | + | |
</pre> | </pre> | ||
− | + | The set command returns "Hello World!" by scraping the element sibling of the tag h1, which contains "DOM lesson one". | |
− | The element sibling | + |
Revision as of 19:06, 27 December 2013
$Element Sibling is a Browser Function.
This function returns the sibling of an element. $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.
The Element Selector is used to select an item.
Element: The desired page element.
Example
load html("<html> <head> <title>DOM Tutorial</title> </head> <body> <h1>DOM Lesson one</h1> <p>Hello world!</p> </body> </html>") set(#sibling, $scrape attribute($element sibling($element sibling(<tagname="h1">)), "innertext"), "Global")
The set command returns "Hello World!" by scraping the element sibling of the tag h1, which contains "DOM lesson one".