Giter Site home page Giter Site logo

Comments (3)

jan-molak avatar jan-molak commented on May 16, 2024

Hey @srinivasbudh!

Since it's Protractor managing the state of the browser, it's also responsible for starting it up.
What this means is that the task to Open simply navigates to a specific page once the browser is already up and running.

In your case you could simply write:

describe('Navigation', function() {
    const chris = Actor.named('Chris').whoCan(BrowseTheWeb.using(protractor.browser));

    it('allows the actor to use a deep link', () => chris.attemptsTo(
        Open.browserOn('https://google.com'),
        Open.browserOn('http://example.com'),
    ));
});

and this would navigate between the two pages.

Having said that, you could also have your own Navigate.to interaction, so that the report does't say that the actor "opens the browser", but "navigates to a url":

export class Navigate implements Interaction {

    static to = (url: string) => new Navigate(url);

    @step('{0} navigate to "#targetUrl"', ActivityType.Interaction)
    performAs(actor: UsesAbilities): PromiseLike<void> {
        return BrowseTheWeb.as(actor).get(this.targetUrl);
    }

    constructor(private targetUrl: string) { }
}

Does this help?
J

from serenity-js.

srinivasbudh avatar srinivasbudh commented on May 16, 2024

Hi,

Thanks a lot I was trying the first solution and I was facing error Webdriver has quit unexpectedly, I am able to use the second solution suggested above. Thanks for the solution.

from serenity-js.

jan-molak avatar jan-molak commented on May 16, 2024

The behaviour of both implementations is the same actually (they both call protractor.browser.get(url) under the hood), the only difference it how they're reported (the @step annotation).

Glad it helped :-)
J

from serenity-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.