question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

beforeCommand, afterCommand do not work when use async

See original GitHub issue

Hello,

I’m trying to use beforeCommand and afterCommand hooks in order to catch browser.url command. unfortunately, it does not work.

    /**
     * Runs before a WebdriverIO command gets executed.
     * @param {String} commandName hook command name
     * @param {Array} args arguments that command would receive
     */
    beforeCommand: function (commandName, args) {
//something
    },

    /**
     * Runs after a WebdriverIO command gets executed
     * @param {String} commandName hook command name
     * @param {Array} args arguments that command would receive
     * @param {Number} result 0 - command success, 1 - command error
     * @param {Object} error error object if any
     */
     afterCommand: function (commandName, args, result, error) {
//something
     },

Did I miss something ?

Thx

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
christian-bromanncommented, Dec 6, 2019

working on a fix

2reactions
mgrybykcommented, Dec 6, 2019

@christian-bromann this is a regression since 5.16.11 and now standalone mode doesn’t work at all.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webdriverio/webdriverio - Gitter
To use the first you have to set the function name to async. ... start pause beforeCommand done 2001 pause afterCommand start pause...
Read more >
jquery - how to get executed command name in beforeCommand or ...
Is there exist a way to figure out which command is fired in "beforecommand:Composer" event ? i.e : Editor.on("beforecommand:composer", function ...
Read more >
Configuration File - WebdriverIO
The configuration file contains all necessary information to run your test suite. It's a NodeJS module that exports a JSON. Here is an...
Read more >
JavaScript Async - W3Schools
Very often we will not need a reject function. Example without reject. async function myDisplay() { let myPromise = new Promise ...
Read more >
Commands Ext — TwitchIO 2 2.0.0a documentation
Method which registers a command for use by the bot. Parameters ... By default if this is not supplied, the function name will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found