Definition and Usage
Check if the web page contains a specified text or element. This command allows you to create conditional logic based on the presence or absence of specific content within a web page.
Note: The If web page contains command must be used with a Go to web page command and an End If command.
Parameter Values
Input parameters
Parameter Name | Description | Possible Values | Required | Options / Notes |
Web page | Select a variable that contains the web page to work with |
| Yes | Must be a valid web page object |
Check if web page | Select a check condition | Contains element, Doesn't contain element, Contains text, Doesn't contain text | Yes | Determines what type of check to perform |
Element | Select or capture an element to operate on |
| Required when checking for elements | Use the Capture button to select an element on the page |
Text | Select or enter text to check for on the web page |
| Required when checking for text | Case sensitivity may affect results |
Variables produced
This action doesn't produce any variables.
Using Variables in Conditions
You can use variables in the parameters of this command by clicking the variable icon or typing {x} where x is your variable name. For example, you could use a variable to specify the text to search for on the web page, allowing for dynamic content checking based on previous operations in your workflow.
Notes
Before using this command, ensure that a valid web page is loaded and accessible.
When checking for elements, make sure the element selector is unique and stable.
Text searches may be affected by dynamic content loading; consider adding appropriate waits before performing text checks.
For more reliable element detection, use unique identifiers or combinations of attributes rather than relying solely on visual appearance.
This command is typically used as part of an If/Else condition structure to create branching logic in your automation workflow.
Example
This workflow will start by navigating to the "https://octoparse.com" page and saving the website URL as a variable named "octoparse_website". Next, it will look for the text "free" on the page. If it finds the text, it will print an information log that reads "Octoparse is free!", and the workflow will be completed.