The input command is used to enter text into the current element. For example:
- You may want to search for a query on a search engine. You can use a value in your scope (Input value option) to determine the text to input.
- You might first get a list of cities in California from Wikipedia, then use each entry in the list as an individual query to monitor keyword rankings.
- You may need to login to a page before accessing your data. You can first select the username box, and input it, and do the same for the password before selecting and Clicking on the login button.
Command Options
Input value
The value to be entered into the current element.
Input type
There are two options for this type of input:
- Text - Treat the input value as a constant string, and enter it into the current element. You should input this in quotations, like this:
"Input goes here"
- Expression - Treat the input value as an expression, evaluate it in the current scope, and enter it into the current element.
Objects Available in Expressions
ParseHub exposes 4 objects available in all expressions. Besides these, ParseHub can also use previously extracted data as variables.
$element or $e represents the current element, and has the following properties:
- $e.text - gets the inner text or value (depending on what type of element is being selected)
- $e.outerHTML - get the outer html of the element
- $e.prop - a function that behaves like jQuery prop function. This lets you compare attributes of an HTML tag that aren't immediately visible on a page. For instance, the star rating of some products
- $e.css - a function that behaves like jQuery css function
- $e.parentProp - a function that behaves like jQuery prop function. If the result is undefined, then you apply the jQuery prop to the parent, and continue doing this until you get a result or hit the html element.
- $e.parent - get the parent element with all the same properties as $e/
$location has the following properties:
- $location.href - gets the current url of the page
$selection has the following properties:
- $selection.length - gets the length of the parent select command to this Conditional
- $selection.index - which is the index of the closest parent selection command
$date.getDate() which gets information about the current date and time
- You can see information about how to extract all different kinds of date and time data here.