Edge WebDriver does not wait for "document.readyState == 'complete'"

Not reproducible Issue #8003878

Details

Author
Nikolay P.
Created
Jun 27, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

Meta -

OS: Windows 10 (using the testing VM from the MS website)

Selenium Version:
2.52.0
Browser:
MS Edge

var webdriver = require('selenium-webdriver')

var edge            = require('selenium-webdriver/edge')
var edgeOptions     = new edge.Options()

edgeOptions.setPageLoadStrategy('normal')

var builder = new webdriver.Builder()
    .forBrowser('MicrosoftEdge')
    .setEdgeOptions(edgeOptions);

var driver = builder.build();
    
driver.get('http://lh/siesta/examples/index.html');

driver.executeScript(function () { return document.readyState }).then(function (res) {
    console.log(res)
})

driver.quit()

Expected Behavior -

To always see the “complete” as the result of the script above

Actual Behavior -

The results of running the script above 4 times in row:

L:\JavaScript\siesta>bin\binary\nodejs\win32\node.exe misc\edgebug\script.js
loading
^C
L:\JavaScript\siesta>bin\binary\nodejs\win32\node.exe misc\edgebug\script.js
loading

L:\JavaScript\siesta>bin\binary\nodejs\win32\node.exe misc\edgebug\script.js
complete

L:\JavaScript\siesta>bin\binary\nodejs\win32\node.exe misc\edgebug\script.js
loading

L:\JavaScript\siesta>

As you can see, the behavior is sporadically different.

As a side note - the script above also “hangs” at the end (also sporadically) and one need to stop it with CTRL+C (see the “^C” above).

Steps to reproduce -

The url in the script should point to a website served from local webserver (the issue is noticed less frequently for http://google.com)

Attachments

1 attachment

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Ibrahim O.”

  • Thank you for the feedback. Could you please go to this link https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ and download the insider version of Webdriver and see if the issue still persists. Please keep us posted about your progress resolving this issue, we will be happy to assist you.

    Best regards,
    The MS Edge Team 

  • Now it fails badly:

    L:\JavaScript\siesta>bin\binary\nodejs\win32\node.exe misc\edgebug\script.js
    L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:654
    throw error;
    ^

    WebDriverError: Unknown error
    at WebDriverError (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\error.js:27:10)
    at Object.checkLegacyResponse (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\error.js:639:15)
    at parseHttpResponse (L:\JavaScript\siesta\node_modules\selenium-webdriver\http\index.js:545:13)
    at L:\JavaScript\siesta\node_modules\selenium-webdriver\http\index.js:479:11
    at ManagedPromise.invokeCallback_ (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:1379:14)
    at TaskQueue.execute_ (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:2913:14)
    at TaskQueue.executeNext_ (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:2896:21)
    at L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:2820:25
    at L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:639:7
    at process._tickCallback (node.js:369:9)
    From: Task: WebDriver.createSession()
    at Function.createSession (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
    at Driver (L:\JavaScript\siesta\node_modules\selenium-webdriver\edge.js:351:38)
    at Builder.build (L:\JavaScript\siesta\node_modules\selenium-webdriver\builder.js:473:16)
    at Object. (L:\JavaScript\siesta\misc\edgebug\script.js:12:22)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions…js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    From: Task: WebDriver.navigate().to(http://lh/siesta/examples)
    at Driver.schedule (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:377:17)
    at Navigation.to (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:1027:25)
    at Driver.get (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:795:28)
    at Object. (L:\JavaScript\siesta\misc\edgebug\script.js:14:8)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions…js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)

    L:\JavaScript\siesta>

    I’m using node v 4.4.5

  • Do you also observe the “hanging” of the script at the end?

  • It works fine on my end. Are you automating this script or using any loops somehow? Here is my testing code with a little change :

    Firstly, please download webdriver Insider version from this link https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/  and run this executable before running the script below.

    var webdriver = require(‘selenium-webdriver’)
    var edge            = require(‘selenium-webdriver/edge’)
    var edgeOptions     = new edge.Options()

    edgeOptions.setPageLoadStrategy(‘normal’)

    var builder = new webdriver.Builder()
        .usingServer(‘http://localhost:17556’)

    .forBrowser(‘MicrosoftEdge’)
        .setEdgeOptions(edgeOptions);

    var driver = builder.build();
        
    driver.get(‘http://lh/siesta/examples/index.html’);

    driver.executeScript(function () { return document.readyState }).then(function (res) {
        console.log(res)
    })

    driver.quit()

    Please let me know your result.

    All the best,
    The MS Edge Team

  • Nope, I’m not automating the script (just launching manually from cmd) and not using any loops (using the exact sources I’ve provided in the beginning).

    I’ve tried to add ".usingServer()" with the same result:

    L:\JavaScript\siesta>bin\binary\nodejs\win32\node.exe --version
    v4.4.5
    
    L:\JavaScript\siesta>bin\binary\nodejs\win32\node.exe misc\edgebug\script.js
    L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:654
        throw error;
        ^
    
    WebDriverError: Unknown error
        at WebDriverError (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\error.js:27:10)
        at Object.checkLegacyResponse (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\error.js:639:15)
        at parseHttpResponse (L:\JavaScript\siesta\node_modules\selenium-webdriver\http\index.js:545:13)
        at L:\JavaScript\siesta\node_modules\selenium-webdriver\http\index.js:479:11
        at ManagedPromise.invokeCallback_ (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:1379:14)
        at TaskQueue.execute_ (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:2913:14)
        at TaskQueue.executeNext_ (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:2896:21)
        at L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:2820:25
        at L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:639:7
        at process._tickCallback (node.js:369:9)
    From: Task: WebDriver.createSession()
        at Function.createSession (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
        at Builder.build (L:\JavaScript\siesta\node_modules\selenium-webdriver\builder.js:458:24)
        at Object. (L:\JavaScript\siesta\misc\edgebug\script.js:13:22)
        at Module._compile (module.js:409:26)
        at Object.Module._extensions..js (module.js:416:10)
        at Module.load (module.js:343:32)
        at Function.Module._load (module.js:300:12)
        at Function.Module.runMain (module.js:441:10)
        at startup (node.js:139:18)
        at node.js:968:3
    From: Task: WebDriver.navigate().to(http://lh/siesta/examples)
        at WebDriver.schedule (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:377:17)
        at Navigation.to (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:1027:25)
        at WebDriver.get (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:795:28)
        at Object. (L:\JavaScript\siesta\misc\edgebug\script.js:15:8)
        at Module._compile (module.js:409:26)
        at Object.Module._extensions..js (module.js:416:10)
        at Module.load (module.js:343:32)
        at Function.Module._load (module.js:300:12)
        at Function.Module.runMain (module.js:441:10)
        at startup (node.js:139:18)
    
    L:\JavaScript\siesta>
    

    Content of "script.js":

    L:\JavaScript\siesta>more misc\edgebug\script.js
    var webdriver = require('selenium-webdriver')
    
    var edge            = require('selenium-webdriver/edge')
    var edgeOptions     = new edge.Options()
    
    edgeOptions.setPageLoadStrategy('normal')
    
    var builder = new webdriver.Builder()
        .usingServer('http://localhost:17556')
        .forBrowser('MicrosoftEdge')
        .setEdgeOptions(edgeOptions);
    
    var driver = builder.build();
    
    driver.get('http://lh/siesta/examples');
    
    driver.executeScript(function () { return document.readyState }).then(function (res) {
        console.log(res)
    })
    
    driver.quit()
    
    L:\JavaScript\siesta>
    

    I’m using “selenium-webdriver” from npm, version 2.53.2

    My guess its the Node version difference, mine is 4.4.5 what is yours?

  • I have been testing on 4.4.7 Can you confirm the issue with that version? If you can still repro with 4.4.7 can you also send me your index.html page? or similar one that also repro.

    All the best,
    The MS Edge Team

  • Same issue with 4.4.7. There’s no “index.html” page - please see the commands I’m running on the console.

    What is your version of “selenium-webdriver” node package? Mine is 2.53.2.

    L:\JavaScript\siesta>bin\binary\nodejs\win32\node.exe --version
    v4.4.7
    
    L:\JavaScript\siesta>more misc\edgebug\script.js
    var webdriver = require('selenium-webdriver')
    
    var edge            = require('selenium-webdriver/edge')
    var edgeOptions     = new edge.Options()
    
    edgeOptions.setPageLoadStrategy('normal')
    
    var builder = new webdriver.Builder()
        .usingServer('http://localhost:17556')
        .forBrowser('MicrosoftEdge')
        .setEdgeOptions(edgeOptions);
    
    var driver = builder.build();
    
    driver.get('http://google.com');
    
    driver.executeScript(function () { return document.readyState }).then(function (res) {
        console.log(res)
    })
    
    driver.quit()
    
    L:\JavaScript\siesta>bin\binary\nodejs\win32\node.exe misc\edgebug\script.js
    L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:654
        throw error;
        ^
    
    WebDriverError: Unknown error
        at WebDriverError (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\error.js:27:10)
        at Object.checkLegacyResponse (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\error.js:639:15)
        at parseHttpResponse (L:\JavaScript\siesta\node_modules\selenium-webdriver\http\index.js:545:13)
        at L:\JavaScript\siesta\node_modules\selenium-webdriver\http\index.js:479:11
        at ManagedPromise.invokeCallback_ (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:1379:14)
        at TaskQueue.execute_ (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:2913:14)
        at TaskQueue.executeNext_ (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:2896:21)
        at L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:2820:25
        at L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\promise.js:639:7
        at process._tickCallback (node.js:369:9)
    From: Task: WebDriver.createSession()
        at Function.createSession (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
        at Builder.build (L:\JavaScript\siesta\node_modules\selenium-webdriver\builder.js:458:24)
        at Object. (L:\JavaScript\siesta\misc\edgebug\script.js:13:22)
        at Module._compile (module.js:409:26)
        at Object.Module._extensions..js (module.js:416:10)
        at Module.load (module.js:343:32)
        at Function.Module._load (module.js:300:12)
        at Function.Module.runMain (module.js:441:10)
        at startup (node.js:139:18)
        at node.js:968:3
    From: Task: WebDriver.navigate().to(http://google.com)
        at WebDriver.schedule (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:377:17)
        at Navigation.to (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:1027:25)
        at WebDriver.get (L:\JavaScript\siesta\node_modules\selenium-webdriver\lib\webdriver.js:795:28)
        at Object. (L:\JavaScript\siesta\misc\edgebug\script.js:15:8)
        at Module._compile (module.js:409:26)
        at Object.Module._extensions..js (module.js:416:10)
        at Module.load (module.js:343:32)
        at Function.Module._load (module.js:300:12)
        at Function.Module.runMain (module.js:441:10)
        at startup (node.js:139:18)
    
    L:\JavaScript\siesta>
    
  • I was testing on selenium 2.53.3 on node js 4.4.7  If you are using OS build 10586 then you should use webdriver 2.10586 "https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ " for insider preview, please try 10.0.14366 from the same link.

     

  • Sorry, I’m using “selenium-webdriver” 2.53.3 too.

    How I can check the OS build? I’ve just downloaded the VM from here: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ (Win 10 with Edge 13)

    The insiders preview still throws the exception. The issue is not fixed in the build 10586.

    huh.

  • You can type winver.exe in start menu and run the executable, this will popup window that contains OS version and build number. Please consider using the correct version of Webdriver for your OS build to ensure it runs correctly.

    All the best,
    The MS Edge Team

  • Ibrahim, the issue is not fixed in the build "10586", I’ve checked.

    The insider preview still just throws exception. There’s a stack trace of it, so you should have all the info.

    Hopefully the issue will be fixed in the next “official” release. I’ll open a new ticket if it won’t.

    Thanks for you help.

  • I can reproduce this issue and generate the same error that you are getting by using incompatible versions of Webdriver and OS build. For instance, I have tested on OS 10586.494 (Latest public build) with Webdriver 10.0.14366.0 (Insider version of webdriver) which gave me "Unknown error". Same issue will be faced, if you use insider preview version of OS and using public version of Webdriver will also generate the same error. This is a known issue in our end. 

    With the compatible version of webdriver and OS build I get “complete” message straight 20 manual trial with no error and 100 trial through loop.

    The only thing I suspect that your OS may be outdated and needs to be updated. Current insider preview build is 14390

    All the best,
    The MS Edge Team  

  • Ok, hopefully the issue is fixed then. Any idea when the fix will be released as part of the “stable” version?

  • Microsoft Edge Team

    Changed Status to “Not reproducible”

  • This fix highly likely to be available in RS1 which will be released soon, however we cannot fully guarantee the fix will be in that update or the next one nor the release date. I will go ahead and close this bug as not repro for now, but please open a new ticket or comment on this feedback if you see any inconsistency in the next release.

    All the best,
    The MS Edge Team

You need to sign in to your Microsoft account to add a comment.

Sign in