-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interesting, but incomplete docs. #5
Comments
Hi @data-envoy, yeah @tg666 did a lot of good work here. The documentation is in progress and we are currently working on other interesting projects. Below I attach the work in progress. If you want, you can start a PR. For better UI testing, I recommend using the CMP administration that Crawler integrates, see https://github.com/68publishers/consent-management-platform. It's better than sending requests via Postman etc. DocsScript SamplesThe following scenarios trigger the first 100 URLs found on the homepage, after clicking the consent modal - one accepts all, the other rejects all: The following scenarios do the same, but open the settings modal and select only the specified category: Basic Config Structure
OptionsNone of the options are required, but it is recommended to set at least maxRequests to avoid crawling the entire website. Here is a list of options: A dot . indicates a nested object.
ScenesA script consists of individual "scenes". One is always the main scene that is executed first - defined in the entrypoint. Others are used for instructions on subsequent sub-pages, or one scene can call another, etc. A scene is essentially an array of actions. EntrypointOnly two required attributes
Actionsclickclick - clicks on an element
clickWithRedirectclickWithRedirect - clicks on an element (typically a link) and waits for redirection
collectCookiescollectCookies - collects cookies from the page, no options required delaydelay - processing waits for the specified time before continuing
enqueueLinksenqueueLinks - finds links on the page and adds them to the request queue
enqueueLinksByClickingenqueueLinksByClicking - same purpose as enqueueLinks, but the links are added to the queue by clicking on them
focusfocus - focuses on the specified element
hoverhover - hovers the mouse over the specified selector
keyboardPresskeyboardPress - presses a specific key
runScenerunScene - executes a "sub-scenario"
runSceneConditionallyrunSceneConditionally - executes a scenario if a condition is met
The condition has a structure similar to actions { "type": "", "options": {} }. Currently, only one condition is implemented, see the Conditions section. screenshotscreenshot - takes a screenshot
selectselect - selects a value from a select box
typetype - types a value into an input/textarea
waitForSelectorwaitForSelector - waits until the specified element appears on the page. If it is not found before the timeout, processing of the page fails
Todo I forgot to include the option to set the timeout in the description, so by default it is set to 30 seconds. Other supported actions that are not used in CMP: collectDatacollectData - collects data from the page. Options include an object where the keys are the names of the individual values, and under each key is an object with options, e.g.
For each key, the options are:
setIdentitysetIdentity - sets an "identity" for the collected data. It is always called before calling collectData
ConditionsisElementVisibleisElementVisible - returns true if the element exists on the page and is visible
|
Oh wow, that looks super helpful! It should be enough to try things out. Sorry, I don't have time right now to make a PR, but maybe in the future. Thank you |
Hey, this looks really cool.
Would it be possible to add some example usage, and maybe explain some more about what a scenario is in this context.
The text was updated successfully, but these errors were encountered: