Taiko: Getting error while looking for window location

Created on 12 Jun 2019  Â·  7Comments  Â·  Source: getgauge/taiko

Expected behavior

It should not fail

Actual behavior

It failing with error
✘ Error: No node with given id found, run.tracefor more info.

Steps to reproduce

  1. launch repl
  2. openBrowser()
  3. evaluate(()=>{return window.location.toString()})

Versions

node : v11.13.0
taiko : d591dcfae8416d6e9b35fc9dc2f9d6d9ac7d86de

help wanted good first issue

All 7 comments

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
>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

suleytron picture suleytron  Â·  3Comments

sguptatw picture sguptatw  Â·  7Comments

SrinivasanTarget picture SrinivasanTarget  Â·  5Comments

rmallof picture rmallof  Â·  8Comments

tkshnwesper picture tkshnwesper  Â·  8Comments