question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow when nativeWebTap is enabled and an implicit wait time is set

See original GitHub issue

The problem

I noticed that my automated tests ran very slow once I enabled nativeWebTab. I’m running automated test for a website/webapp on mobile Safari. It looks like the time is spent waiting to check wether the ‘app download’ banner is present (“Close app download offer”)

Environment

  • Appium version (or git revision) that exhibits the issue: 1.20.0-beta.0
  • Last Appium version that did not exhibit the issue (if applicable): -
  • Desktop OS/version used to run Appium: macOS 11.1
  • Node.js version (unless using Appium.app|exe): v10.22.1
  • Npm or Yarn package manager: npm
  • Mobile platform/version under test: iOS 14
  • Real device or emulator/simulator: real device
  • Appium CLI or Appium.app|exe: Appium CLI

Details

From what I can tell, the full implicit wait time is used when no app download banner can be found. I base this on what I see happening in the logs:

2021-01-04 08:43:38:595 - [debug] [WD Proxy] Got response with status 200: {"value":[],"sessionId":"9E85DB0D-FBA7-402E-B61F-4E3CAB095BF1"}
2021-01-04 08:43:38:595 - [debug] [BaseDriver] Waited for 92 ms so far
2021-01-04 08:43:39:104 - [debug] [WD Proxy] Matched '/elements' to command name 'findElements'
2021-01-04 08:43:39:104 - [debug] [WD Proxy] Proxying [POST /elements] to [POST http://127.0.0.1:8100/session/9E85DB0D-FBA7-402E-B61F-4E3CAB095BF1/elements] with body: {"using":"accessibility id","value":"Close app download offer"}
2021-01-04 08:43:39:224 - [debug] [WD Proxy] Got response with status 200: {"value":[],"sessionId":"9E85DB0D-FBA7-402E-B61F-4E3CAB095BF1"}
2021-01-04 08:43:39:224 - [debug] [BaseDriver] Waited for 721 ms so far
2021-01-04 08:43:39:728 - [debug] [WD Proxy] Matched '/elements' to command name 'findElements'
2021-01-04 08:43:39:728 - [debug] [WD Proxy] Proxying [POST /elements] to [POST http://127.0.0.1:8100/session/9E85DB0D-FBA7-402E-B61F-4E3CAB095BF1/elements] with body: {"using":"accessibility id","value":"Close app d

The above is repeated until the implicit wait time has been reached. When I set implicit wait to 0 I see only a single /elements call and tests run a lot faster

Relevant code section: https://github.com/appium/appium-xcuitest-driver/commit/0f0def5f83fd074a5e146f0a6adc22cac38e6105#diff-25755c8ae7a2cf33e8a411451653876ea735824b8f66498da73b865b41fed129R91

Link to Appium logs

https://gist.github.com/felixhageloh/e4bf58473cdfec71d0965174e9661fd5

Code To Reproduce Issue [ Good To Have ]

RSpec setup

spec_helper.rb

require 'rubygems'
require 'appium_lib'
require './action_helpers'

opts = {
  caps: {
    platformName: 'iOS',
    platformVersion: '14',
    automationName: 'XCUITest',
    browserName: 'Safari',
    udid: 'XXXXXXX-XXXXXXXXXX',
    deviceName: 'iPhone',
    nativeWebTap: true,

    xcodeOrgId: 'XXXXXXXX',
    xcodeSigningId: 'iPhone Developer'
  },
  appium_lib: {
    wait_timeout: 1
  }
}

RSpec.configure do |config|
  config.include ActionHelpers

  config.before(:suite) do
    @driver = Appium::Driver.new(opts, true).start_driver
    @driver.manage.timeouts.implicit_wait = 5
    Appium.promote_appium_methods RSpec::Core::ExampleGroup
  end

  config.after(:all) do
    driver_quit
  end
end

RSpec test code

require './spec_helper'

describe 'mobile reader' do
  it 'works just fine' do
    get('https://view.publitas.com/34rd/island-hopping')
    expect(title).to eq(
      '34rtrth - Island Hopping - Page 1 - Created with Publitas.com'
    )

    swipe(direction: 'left')
    sleep(0.5)
    expect(title).to eq(
      '34rtrth - Island Hopping - Page 2-3 - Created with Publitas.com'
    )

    sleep(1)

    find_element(
      :css,
      "[aria-label='Ancracietgrijze kostuumvest - Sami - slim fit - More info']"
    ).click

    sleep(1)

    expect(title).to eq(
      '34rtrth - Island Hopping - Ancracietgrijze kostuumvest - Sami - slim fit - Created with Publitas.com'
    )

    find_element(:link_text, 'Go to webshop').click
    sleep(5)

    expect(current_url).to eq(
      'https://www.e5mode.be/nl/dansaert-black-ancracietgrijze-kostuumvest-sami-slim-fit-w0db08bs004-5569416?channable=00da03696400353538393735ba#578=13992'
    )

    driver.close

    find_element(:css, '[aria-label="Close"]').click
    sleep(1)
  end
end

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mykola-mokhnachcommented, Jan 5, 2021

Your guess is right: /touch/perform API is not a part of W3C spec, it is a custom Appium stuff, that slowly gets obsolete and deprecated. Safari driver uses /actions API instead.

1reaction
KazuCocoacommented, Jan 4, 2021

Yes, safaridriver should work well… (I hope)

https://github.com/appium/appium-xcuitest-driver/pull/1265 may help

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why webdriver waits longer than defined time on implicit wait?
This of course will work, because the implicit wait is set to 15 second and the app will take no longer than 12...
Read more >
Desired Capabilities - Appium
This set of Desired Capabilities expresses the desire for Appium to begin an ... Amount of time to wait for Webview context to...
Read more >
Selenium Wait Commands : Implicit, Explicit & Fluent Wait
Implicit Wait directs the Selenium WebDriver to wait for a certain measure of time before throwing an exception. Once this time is set, ......
Read more >
Selenium Wait – Implicit, Explicit and Fluent Waits - Guru99
Let's consider a scenario where we have to use both implicit and explicit waits in our test. Assume that implicit wait time is...
Read more >
Implicit and Explicit Wait in Selenium WebDriver (Types of ...
Implicit waits are used to provide a default waiting time (say 30 ... Thus, this is all that is required to set an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found