'How to get response from cy.exec()
I am having hard time trying to get response from cy.exec() call. For example:
cy.exec("java -version").then((response) => {
cy.log("response is " + response);
});
The output I have is looking like this:
log response is [object Object]
What do I do wrong here?
Solution 1:[1]
In the docs
cy.exec() yields an object with the following properties:
- code
- stdout
- stderr
So for your particular execution string, the response is probably on stdout
cy.exec("java -version").then((response) => {
cy.log("response is " + response.stdout);
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Fody |
