dequelabs / axe-core-npm

Mozilla Public License 2.0
576 stars 65 forks source link

webdriverio does not support iOS devices #338

Open straker opened 2 years ago

straker commented 2 years ago

It appears that on iOS devices, switcToFrame and switchToParentFrame are not implemented so our code fails with a very unhelpful message

WARN webdriver: Request failed with status 501 due to Method is not implemented

smanish83 commented 2 years ago

Additional information about the environment: Device: iOS - Fails Android - Pass Browser Safari, Chrome, Firefox, Opera (Tests fails on iOS browsers) WebDriverIO browser API - https://webdriver.io/docs/api/browser/$$

gromanas commented 4 months ago

Hello! Any updates on this? Also, I believe the message is

[0-0] 2024-02-22T15:09:06.075Z INFO webdriver: [POST] https://ondemand.eu-central-1.saucelabs.com/wd/hub/session/453552481bd84cb0bcc6cb733c1a6d97/frame/parent
[0-0] 2024-02-22T15:09:06.075Z WARN webdriver: Request failed with status 405 due to Method has not yet been implemented
[0-0] 2024-02-22T15:09:06.190Z DEBUG webdriver: request failed due to response error: unknown method
[0-0] 2024-02-22T15:09:06.190Z ERROR webdriver: Request failed with status 405 due to unknown method: Method has not yet been implemented

I have seen this issue from Appium and it seems that is working: https://github.com/appium/appium/issues/14882#issuecomment-1693326102

maybe we can make the setBrowsingContext

   async setBrowsingContext(id = null) {
    if (id || browser.isIOS || browser.requestedCapabilities.browserName === 'safari') {
      await this.client.switchToFrame(id);
    } else {
      await this.client.switchToParentFrame();
    }
  }

Although we are getting then the same error as without using the legacy mode

[0-0] 2024-02-22T15:44:40.488Z INFO webdriver: [POST] https://ondemand.eu-central-1.saucelabs.com/wd/hub/session/91e1ed0a21f5447d9fbcd889563a2596/execute/async
[0-0] 2024-02-22T15:44:40.488Z WARN webdriver: Request failed with status 408 due to Timed out waiting for asynchronous script result after 70 ms
[0-0] 2024-02-22T15:44:40.488Z INFO webdriver: DATA {
[0-0]   script: 'var callback = arguments[arguments.length - 1];\n' +
[0-0]     '      var context = {"exclude":[]} || document;\n' +
[0-0]     '      var options = {"runOnly":{"type":"tag","values":["wcag2a","wcag2aa"]}} || {};\n' +
[0-0]     '      var config = undefined || null;\n' +
[0-0]     '      if (config) {\n' +
[0-0]     '        window.axe.configure(config);\n' +
[0-0]     '      }\n' +
[0-0]     '      window.axe.run(context, options).then(function (axeResults) {\n' +
[0-0]     '        callback(JSON.stringify(axeResults))\n' +
[0-0]     '      });',
[0-0]   args: []
[0-0] }
straker commented 4 months ago

@gromanas Unfortunately we have no update on this at this time. Since the two functions in question are pretty essential for the code, we'll have to see what we can even do. In the mean time a workaround is to use the setLegacyMode(true) function which won't use the two functions. The function is deprecated though so will be removed when we release 5.0 (no schedule on when that will be).

gromanas commented 4 months ago

@straker Ι think switchToFrame it is implemented. The error occurs on switchToParentFrame. I have a suggestion also above on how to fix it (or to get an idea 😄 ) according to an Appium issue https://github.com/appium/appium/issues/14882#issuecomment-1693326102.