ulixee / hero

The web browser built for scraping
MIT License
657 stars 32 forks source link

Flow Commands #98

Closed blakebyrnes closed 2 years ago

blakebyrnes commented 2 years ago

This PR introduces the notion of Flow Commands.

Flow commands allow a user to define a code block that will be retried a configurable number of times in the case where an AwaitedDom error occurs. They can be nested and will resume individual blocks. NOTE: A block will only be retried if a flow handler matches the current state and attempts to resolve it.

Flow commands accept an "ExitState" (a DomState) that will be checked before leaving a block. If it is unsuccessful, the flow handlers will be triggered and if any match, the block will try again.