Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webdriverjs hangs when page has lazy loaded iframe #744

Closed
straker opened this issue Jun 7, 2023 · 2 comments · Fixed by #743
Closed

Webdriverjs hangs when page has lazy loaded iframe #744

straker opened this issue Jun 7, 2023 · 2 comments · Fixed by #743
Labels
bug Something isn't working PACKAGE: webdriverjs PRIORITY: critical Critical priority item; should be worked on immediately signOff-QA

Comments

@straker
Copy link
Contributor

straker commented Jun 7, 2023

Similar to #727, webdriverjs has a similar issue when encountering a lazy loaded iframe. However instead of failing when selecting the iframe, it instead hangs on the switchTo().frame call and won't release until the pageLoad selenium timeout. There's also another issue in that switchTo().frame timing out puts the driver into a bad state so when we try to process the results we try to call executeScript and that hangs until the script selenium timeout before the code finally gives an error message.

Note that this only happens when using chromedriver. Using gekodriver doesn't have this issue.

@straker straker added bug Something isn't working PRIORITY: critical Critical priority item; should be worked on immediately PACKAGE: webdriverjs labels Jun 7, 2023
@padmavemulapati
Copy link

Valdiated with the latest build - 4.7.3-alpha.398

testfile

const AxeBuilder = require('@axe-core/webdriverjs');
const WebDriver = require('selenium-webdriver');
const fs = require('fs');

const driver = new WebDriver.Builder().forBrowser('chrome').build();

driver.get('https://broken-workshop.dequelabs.com/').then(() => {
  new AxeBuilder(driver).analyze(function (err, results) {
    if (err) {
      // Handle error somehow
    }
    fs.writeFile("./Analyse472.json", JSON.stringify(results, null,4),(err)=>
    {if(err){
        console.error(err);
        return;
        };
        console.log("File has been created");
    })
  });
});

also tried test page: https://www.rastoder.si/

this same test worked well for 4.7.2 version and now getting below error:

/Users/dq_user/Downloads/axe-core-integrations/axe-core-npm-integrations/webdriverjs/test.js:9
  new AxeBuilder(driver)
  ^

TypeError: AxeBuilder is not a constructor
    at /Users/dq_user/Downloads/axe-core-integrations/axe-core-npm-integrations/webdriverjs/test.js:9:3
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.7.0

Note: Build 4.7.3-alpha.398 is working fine for .mjs test.

@padmavemulapati
Copy link

Verified the fix, updated the changes to the test file,
testfile now looks like:

const { AxeBuilder } = require('@axe-core/webdriverjs');
const WebDriver = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const fs = require('fs');
const driver = new WebDriver.Builder().forBrowser('chrome').setChromeOptions(new chrome.Options().headless()).build();

driver.get('https://www.rastoder.si/').then(() => {
  new AxeBuilder(driver) .analyze(function (err, results) {
    if (err) {
      // Handle error somehow
    }
    fs.writeFile("./lazyloadpage.json", JSON.stringify(results, null,4),(err)=>
    {if(err){
        console.error(err);
        return;
        };
        console.log("File has been created");
    })
  });
});

Got the results in "lazyloadpage.json"

Environment:

Label Value
Product @axe-core/webdriverjs
Version 4.7.3-alpha.398
selenium-webdriver version 24.10.0
Chromedriver Version 114.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PACKAGE: webdriverjs PRIORITY: critical Critical priority item; should be worked on immediately signOff-QA
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants