Skip to content
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

[RFC] Scenario plugin system #26

Open
PedroTroller opened this issue Oct 4, 2015 · 2 comments
Open

[RFC] Scenario plugin system #26

PedroTroller opened this issue Oct 4, 2015 · 2 comments

Comments

@PedroTroller
Copy link
Contributor

Hi.

Just a little reflection. Why not provide a system that allow you to describe some scenarios to execute before to crawl urls.

For example :

// MyProject/centipede.php
$scenarios = new Centipede\Scenario\Collection();

$scenarios->add('customer_account', function ($browser) {
    $broswer->visit('/login');
    $broswer->fillIn('login', 'account@email.com');
    $broswer->fillIn('password', 'strong_password');
    $broswer->press('Connection');
    $broswer->visit('/account');
});

$scenarios->add('backoffice', function ($browser) {
    $broswer->visit('/admin/login');
    $broswer->fillIn('seller[uuid]', '1122334455');
    $broswer->fillIn('seller[password]', 'strong_password');
    $broswer->press('Access to dashboard');
    $broswer->visit('/admin/dashboard');
});

$scenarios->add('public', function ($browser) {
    $broswer->visit('/');
});

return $scenarios;

And then, the crawler will execute scenarios one by one and crawl urls each time.

@umpirsky
Copy link
Owner

umpirsky commented Oct 4, 2015

Yes, this would be interesting approach. In this case browser must share same session with guzzle client used in centipede crawler.

It is in deed simple extension point without reinventing the wheel, I like it.

Thanks @PedroTroller!

@umpirsky umpirsky changed the title [RFC] Crawler based on scenarios [RFC] Scenario plugin system Nov 10, 2015
@Pierstoval
Copy link

You could use Symfony's Client and DomCrawler classes for this (even if not asynchronous).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants