<< <%SKIN-STRTRANS-SYNTOC%> >> Navigation: Agent Commands > Action Commands > Action Configuration > Wait for Content |
Wait for Content commands can be used to wait for web content to appear on a web page, or to wait for a specific URL to complete loading.
A Wait for Content command must be a direct sub-command of an action command and will work in conjunction with the action command. When an action command contains multiple Wait for Content sub-commands, the action command will wait until a condition specified by any of these commands is satisfied.
A Wait for Content command cannot be a sub-command of a HTML List command or a HTML Area command, unless the HTML area is broken by the Wait for Content command's parent action command. An action command breaks a HTML area by default, so this limitation is rarely relevant.
When a Wait for Content command is configured to wait for web content, a web element must be selected in the web browser, and the Wait for Content command's parent action command will wait until that web element is available on the web page.
The web selection for Wait for Content commands works differently than for other commands that require a web selection. The selection XPaths specified by a Wait for Content command are used directly in a web page while it's loading, before the page is parsed by Content Grabber, so the XPaths cannot use extended Content Grabber syntax, but must follow strict XPath 1.0 syntax. Furthermore, because the XPaths are used before Content Grabber has parsed the web page, the XPaths cannot work across frames, and the frame or iframe node names are therefore not valid in these XPaths. Content Grabber will use the XPaths to search for the web content in all available frames and iframes.
Multiple Wait for Web Content commands or a single command with multiple selection XPaths can be used to cover different scenarios. For example, if an action command must wait for a search result to appear on the web page, but sometimes the search result is empty and a message is displayed instead of the search result, then one selection XPath can be used to select the search result, and another XPath used to select the message that appears when the search result is empty. This means the command will not wait around for the search result to appear on the page if the search result is empty, but instead stop waiting as soon as the empty search message appears on the page.
When a Wait for Content command is configured to wait for a URL, a regular expression must be specified, and the Wait for Content command's parent action command will wait for a URL that matches that regular expression. Content Grabber will check the URL of all frames and all web requests that load content asynchronously.
The parent action command of one or more Wait for Content commands specifies how long the action command should wait for content and if the content is optional or required. For convenience, you can change these action options while editing a Wait for Content command. When you change these options for one Wait for Content command, the options will automatically change for all Wait for Content commands with the same parent action command. You can also configure these options directly on the parent action command.