I have a variable "currentPage" which I want to set to the current URL on the running page. But to see that the URL is correct I want to print it to the console. What ever I try I keep getting "not defined", "object", ... If I on the other hand use the "await t.expect(...)" method and make it fail then I see the wanted URL.
const getURL = ClientFunction(() => window.location.href);
console.log(getURL) //does not work
console.log(getURL()) //does not work
Can I write it to console output? If so then I guess it should also be possible to do something like "currentPage = getURL()" but I get:
current page function __$$clientFunction$$() {
You've missed the await
keyword before calling ClientFunction. Please refer to http://devexpress.github.io/testcafe/documentation/test-api/obtaining-data-from-the-client.html#executing-client-functions.
I suggest you write it in the following manner:
const url = await getURL();
console.log(url);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With