Slow when nativeWebTap is enabled and an implicit wait time is set
See original GitHub issueThe 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:
- Created 3 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
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.Yes, safaridriver should work well… (I hope)
https://github.com/appium/appium-xcuitest-driver/pull/1265 may help