Question

I wonder how can we switch between URLs when using casperjs: For example , I have

    casper.test.begin('Story', function suite(test) {
    casper.start("http://localhost:8000/", casper.entryPointOne);
    // POINT - P

    casper.run(function() {
        test.done();
    });

});

Now if at POINT-P (in above code), I want to access entirely different url : for example I want to access www.gooogle.com, is it possible?

I need this in order to test a scenario, where we access a *settings' page, save new settings , got to new UrL (lets say Google) and then use those settings .

Problem here is that after settings are saved, I start a new test which uses default settings and do not use new settings.

Any idea how to do that?

Était-ce utile?

La solution

Use thenOpen to open subsequent url's.

 casper.test.begin('Story', function suite(test) {
    casper.start("http://localhost:8000/", casper.entryPointOne);
    // POINT - P

casper.thenOpen('http://www.noobmovies.com')

    casper.run(function() {
        test.done();
    });

});
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top