Skip to content

Check AJAX/Javascript requests? #13

Closed

Description

@BlaM

Is there a way to check invisible things going on on the page?

For example if I have a webpage that sends a tracking pixel request (not adding the to the DOM) / AJAX request can I run checks on the requested URL?

If not, are you thinking about adding that as a feature?

Activity

  1. DavertMik commented on Dec 8, 2015

    @DavertMik
    Contributor

    Nothing like that is ready yet. Can you suggest how this feature may look like?

  2. BlaM commented on Dec 8, 2015

    @BlaM
    Author

    One note in advance: I'm not yet using CodeceptJS, so anything I say now may not fit into the CodeceptJS mindset. So far we're still investigating which tool to use for our usecase.

    @stanjer In my case I can find the image tag in a JavaScript object but not in the page's html code.

    window.x = new Image();
    window.x.src = 'http://placehold.it/350x150';
    

    So: Yes.

    That would not work however if the page had AJAXed home to the server.

    @DavertMik I have never used Selenium so I don't know if there is something like PhantomJS' onResourceRequested. CodedeptJS would have to keep track of outgoing requests with that.

    Maybe something like this?

    I.startMonitoringWebRequests();
    I.click(this.submitButton);
    I.wait(1);
    I.sawWebRequestUrlContaining('placehold.it');
    

    Where the last command checks if there was at least one web request to a URL containing the specified string (since the last time we started monitoring).

    Not sure if that makes any sense and if it is in scope for CodeceptJS - but it would make things easier for us.

  3. aleksandargosevski commented on Sep 10, 2016

    @aleksandargosevski

    This would be very helpful.

  4. DavertMik commented on Jan 14, 2017

    @DavertMik
    Contributor

    Yeah, good idea but I think this should be implemented as custom helper and not a general purpose method. If someone is interested they can develop and publish such helper on NPM or propose it with pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions