Definition and Usage
This command checks if a web page contains specified content (element or text) when previous conditions are false, and executes subsequent actions if the condition is true. It serves as an additional conditional branch in an if-else structure for web page content verification.
Note: The Else If webpage contains command must be used in conjunction with an If command and Go to webpage 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 variable |
Check if web page | To check if web page contains certain element or text | Contains element, Doesn't contain element, Contains text, Doesn't contain text | Yes | Selection determines which verification 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 content | Enter the text content to check for on the web page |
| Required when checking for text | Case sensitivity may apply depending on implementation |
Variables produced
This action doesn't produce any variables.
Using Variables in Conditions
You can use previously defined variables in the parameters of this command by clicking the variable icon or typing {x} where x is your variable name. This is particularly useful when:
Referencing a web page variable obtained from a previous "Open browser" or similar command
Checking for dynamic text content stored in variables
Creating conditional logic based on variable values
Notes
This command must be used after an "If" or "Else if" condition in your workflow
If the condition evaluates to true, the actions within this branch will execute
If the condition evaluates to false, execution will continue to the next "Else if" or "Else" branch, if any
When checking for text content, consider that some web pages may have hidden text that could affect your condition
Element-based checks are more reliable for structured content, while text-based checks are better for dynamic content
Example
This workflow will start by navigating to the "https://www.octoparse.ai" page and saving the website URL as a variable named "webPage". Then it goes to check whether the webPage is empty. Since it is false, the workflow will look for the text "started" on the page. If it finds the text, it will print an information log that reads "Get started with Octoparse AI", and the workflow will be completed.