It should not fail
It failing with error
✘ Error: No node with given id found, run.tracefor more info.
node : v11.13.0
taiko : d591dcfae8416d6e9b35fc9dc2f9d6d9ac7d86de
Working on this.
@shrirambalakrishnan @luciferankon What is the use case of running an evaulate on blank page.
Below code snippet works fine.
const { openBrowser, goto, evaluate, closeBrowser } = require('taiko');
(async () => {
try {
await openBrowser();
await goto('google.com');
await evaluate(()=>{return window.location.toString()});
} catch (error) {
console.error(error);
} finally {
await closeBrowser();
}
})();
Result:https://www.google.com/?gws_rd=ssl
@saikrishna321
It's a failing edge case. I can't think of any use case though.
evaluate(()=>{return window.location.toString()}) fails only when executed immediately after openBrowser().
It works after explicitly navigating to goto("about:blank") by returning
Result:about:blank
Instead of the API failing my thought would just throw a warning to the users if evaluate() before goto()
Since we can't think of any use case for this, my suggestion will be to raise exception if user tries to evaluate() in the blank page.
Please let me know your thoughts on this.
The url on the location bar on the chromium instance after openBrowser is about:blank so ideally it should return Result:about:blank
Working on 1.0.16
Version: 1.0.16 (Chromium: 85.0.4168.0)
Type .api for help and .exit to quit
> openBrowser()
✔ Browser opened
> evaluate(()=>{return window.location.toString()})
'about:blank'
✔ Evaluated given script. Result:about:blank
>