Element From Text

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Created page with "$Element Offset is a Browser Function. This function converts a text representation of a selector into an actual selector. == Example == <pre> navigat...")
 
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
 
$Element Offset is a [[Browser Functions|Browser Function]].
 
$Element Offset is a [[Browser Functions|Browser Function]].
  
This function converts a text representation of a selector into an actual selector.
+
This function will use the value of variables, list items, table cell items or scraped text as attributes in functions that require attributes.
  
== Example ==
+
'''Selector:''' Where the written attribute or the variable/list item/table cell is inserted.
 +
 
 +
== Example 1 ==
 
<pre>
 
<pre>
  
Line 13: Line 15:
 
</pre>
 
</pre>
  
The element from text function allows you to write your own selectors.
 
  
In this example, the element from text function uses the selector in the variable "#Selector" to select the field on the page and fill the field with the type text command.  
+
In this example, the element from text function uses the attribute in the variable "#Selector" to select the field on the page and fill the field with the type text command.
 +
 
 +
 
 +
[[File:cmwu6.jpg]]
 +
 
 +
 
 +
== Example 2 ==
 +
 
 +
<pre>
 +
navigate("http://www.google.com/", "Wait")
 +
add item to list(%list, "<name=q>", "Delete", "Global")
 +
wait(4)
 +
type text($element from text($list item(%list, 0)), "Hello there!", "Standard")
 +
</pre>
 +
 
  
[[File:elementfromtext.png]]
+
In this example, the element from text function uses the attribute in the list item at position 0 from "%list" to select the field on the page and fill the field with the type text command.

Latest revision as of 21:28, 6 February 2017

$Element Offset is a Browser Function.

This function will use the value of variables, list items, table cell items or scraped text as attributes in functions that require attributes.

Selector: Where the written attribute or the variable/list item/table cell is inserted.

[edit] Example 1


navigate("http://www.google.com/", "Wait")
wait(4)
set(#selector, "<name=q>", "Global")
type text($element from text(#selector), "Hello there!", "Standard")


In this example, the element from text function uses the attribute in the variable "#Selector" to select the field on the page and fill the field with the type text command.


Cmwu6.jpg


[edit] Example 2

navigate("http://www.google.com/", "Wait")
add item to list(%list, "<name=q>", "Delete", "Global")
wait(4)
type text($element from text($list item(%list, 0)), "Hello there!", "Standard")


In this example, the element from text function uses the attribute in the list item at position 0 from "%list" to select the field on the page and fill the field with the type text command.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox