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.

sendKeyStrategy - is it possible to apply a different strategy for each sendKeys?

See original GitHub issue

I use sendKeyStrategy - setValue throughout the app, but there is a single field that does not play nice with it (but works fine with OneByOne).

Is it possible to use SetValue throughout the test but switch to OneByOne for specific instances of sendKeys?

Logs and code below:

in my capabilities i have



capabilities.setCapability("sendKeyStrategy","setValue");

code that fails is below:

WebElement loginField = driver.findElement(MobileBy.IosUIAutomation("target.frontMostApp().mainWindow().scrollViews()[0].elements()["loginField"].textFields()[0];"));

loginField.click();
loginField.sendKeys(username);

logs below:

info: [debug] Pushing command to appium work queue: "au.getElementsByUIAutomation('target.frontMostApp().mainWindow().scrollViews()[0].elements()[\\\"loginField\\\"].textFields()[0];')"
info: [debug] Sending command to instruments: au.getElementsByUIAutomation('target.frontMostApp().mainWindow().scrollViews()[0].elements()[\"loginField\"].textFields()[0];')
info: [debug] [INST] 2015-07-16 10:43:03 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-07-16 10:43:03 +0000 Debug: responding with:
info: [debug] [INST] 2015-07-16 10:43:03 +0000 Debug: Running system command #67: /usr/local/Cellar/node/0.12.2_1/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] [INST] 2015-07-16 10:43:04 +0000 Debug: Got new command 67 from instruments: au.getElementsByUIAutomation('target.frontMostApp().mainWindow().scrollViews()[0].elements()[\"loginField\"].textFields()[0];')
info: [debug] [INST] 2015-07-16 10:43:04 +0000 Debug: evaluating au.getElementsByUIAutomation('target.frontMostApp().mainWindow().scrollViews()[0].elements()[\"loginField\"].textFields()[0];')
info: [debug] [INST] 2015-07-16 10:43:04 +0000 Debug: byUIAutomation: evaluating code: target.frontMostApp().mainWindow().scrollViews()[0].elements()["loginField"].textFields()[0];
info: [debug] [INST] 2015-07-16 10:43:04 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-07-16 10:43:04 +0000 Debug: Lookup returned [object UIATextField] with the name "Type CVV" (id: 30).
info: [debug] [INST] 2015-07-16 10:43:04 +0000 Debug: responding with:
info: [debug] [INST] 2015-07-16 10:43:04 +0000 Debug: Running system command #68: /usr/local/Cellar/node/0.12.2_1/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":[{"ELEMENT":"30"}]}...
info: [debug] Socket data received (41 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":[{"ELEMENT":"30"}]}
info: [debug] Responding to client with success: {"status":0,"value":[{"ELEMENT":"30"}],"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/elements 200 1135.591 ms - 90 {"status":0,"value":[{"ELEMENT":"30"}],"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/timeouts/implicit_wait {"ms":10000}
info: [debug] Set iOS implicit wait to 10000ms
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/timeouts/implicit_wait 200 0.933 ms - 76 {"status":0,"value":null,"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/element/30/click {"id":"30"}
info: [debug] Pushing command to appium work queue: "au.tapById('30')"
info: [debug] Sending command to instruments: au.tapById('30')
info: [debug] [INST] 2015-07-16 10:43:05 +0000 Debug: Got new command 68 from instruments: au.tapById('30')
info: [debug] [INST] 2015-07-16 10:43:05 +0000 Debug: evaluating au.tapById('30')
info: [debug] [INST] 2015-07-16 10:43:05 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].elements()["loginField"].textFields()[0].tap()
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/element/30/click 200 1230.914 ms - 74 {"status":0,"value":"","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/timeouts/implicit_wait {"ms":0}
info: [debug] Set iOS implicit wait to 0ms
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/timeouts/implicit_wait 200 0.943 ms - 76 {"status":0,"value":null,"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> GET /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/context {}
info: [debug] Responding to client with success: {"status":0,"value":"NATIVE_APP","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- GET /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/context 200 0.889 ms - 84 {"status":0,"value":"NATIVE_APP","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/elements {"using":"-ios uiautomation","value":"target.frontMostApp().mainWindow().scrollViews()[0].elements()[\"loginField\"].textFields()[0];"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: "au.getElementsByUIAutomation('target.frontMostApp().mainWindow().scrollViews()[0].elements()[\\\"loginField\\\"].textFields()[0];')"
info: [debug] Sending command to instruments: au.getElementsByUIAutomation('target.frontMostApp().mainWindow().scrollViews()[0].elements()[\"loginField\"].textFields()[0];')
info: [debug] [INST] 2015-07-16 10:43:05 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-07-16 10:43:05 +0000 Debug: responding with:
info: [debug] [INST] 2015-07-16 10:43:05 +0000 Debug: Running system command #69: /usr/local/Cellar/node/0.12.2_1/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] [INST] 2015-07-16 10:43:06 +0000 Debug: Got new command 69 from instruments: au.getElementsByUIAutomation('target.frontMostApp().mainWindow().scrollViews()[0].elements()[\"loginField\"].textFields()[0];')
info: [debug] [INST] 2015-07-16 10:43:06 +0000 Debug: evaluating au.getElementsByUIAutomation('target.frontMostApp().mainWindow().scrollViews()[0].elements()[\"loginField\"].textFields()[0];')
info: [debug] [INST] 2015-07-16 10:43:06 +0000 Debug: byUIAutomation: evaluating code: target.frontMostApp().mainWindow().scrollViews()[0].elements()["loginField"].textFields()[0];
info: [debug] [INST] 2015-07-16 10:43:06 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-07-16 10:43:06 +0000 Debug: Lookup returned [object UIATextField] with the name "Type CVV" (id: 31).
info: [debug] [INST] 2015-07-16 10:43:06 +0000 Debug: responding with:
info: [debug] [INST] 2015-07-16 10:43:06 +0000 Debug: Running system command #70: /usr/local/Cellar/node/0.12.2_1/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":[{"ELEMENT":"31"}]}...
info: [debug] Socket data received (41 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":[{"ELEMENT":"31"}]}
info: [debug] Responding to client with success: {"status":0,"value":[{"ELEMENT":"31"}],"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/elements 200 977.095 ms - 90 {"status":0,"value":[{"ELEMENT":"31"}],"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/timeouts/implicit_wait {"ms":10000}
info: [debug] Set iOS implicit wait to 10000ms
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/timeouts/implicit_wait 200 2.090 ms - 76 {"status":0,"value":null,"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/element/31/value {"id":"31","value":["737"]}
info: [debug] Pushing command to appium work queue: "au.getElement('31').setValueByType('737')"
info: [debug] Sending command to instruments: au.getElement('31').setValueByType('737')
info: [debug] [INST] 2015-07-16 10:43:07 +0000 Debug: Got new command 70 from instruments: au.getElement('31').setValueByType('737')
info: [debug] [INST] 2015-07-16 10:43:07 +0000 Debug: evaluating au.getElement('31').setValueByType('737')
info: [debug] [INST] 2015-07-16 10:43:07 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].elements()["loginField"].textFields()[0].tap()
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/element/31/value 200 1203.633 ms - 74 {"status":0,"value":"","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/element {"using":"-ios uiautomation","value":"target.frontMostApp().windows()[1].toolbars()[0].buttons()[0]"}
info: [debug] Waiting up to 10000ms for condition
info: [debug] Pushing command to appium work queue: "au.getElementByUIAutomation('target.frontMostApp().windows()[1].toolbars()[0].buttons()[0]')"
info: [debug] Sending command to instruments: au.getElementByUIAutomation('target.frontMostApp().windows()[1].toolbars()[0].buttons()[0]')
info: [debug] [INST] 2015-07-16 10:43:07 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-07-16 10:43:07 +0000 Debug: responding with:
info: [debug] [INST] 2015-07-16 10:43:07 +0000 Debug: Running system command #71: /usr/local/Cellar/node/0.12.2_1/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] [INST] 2015-07-16 10:43:08 +0000 Debug: Got new command 71 from instruments: au.getElementByUIAutomation('target.frontMostApp().windows()[1].toolbars()[0].buttons()[0]')
info: [debug] [INST] 2015-07-16 10:43:08 +0000 Debug: evaluating au.getElementByUIAutomation('target.frontMostApp().windows()[1].toolbars()[0].buttons()[0]')
info: [debug] [INST] 2015-07-16 10:43:08 +0000 Debug: byUIAutomation: evaluating code: target.frontMostApp().windows()[1].toolbars()[0].buttons()[0]
info: [debug] [INST] 2015-07-16 10:43:08 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-07-16 10:43:08 +0000 Debug: Lookup returned [object UIAButton] with the name "Done" (id: 32).
info: [debug] [INST] 2015-07-16 10:43:08 +0000 Debug: responding with:
info: [debug] [INST] 2015-07-16 10:43:08 +0000 Debug: Running system command #72: /usr/local/Cellar/node/0.12.2_1/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":{"ELEMENT":"32"}}...
info: [debug] Socket data received (39 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":{"ELEMENT":"32"}}
info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"32"},"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/element 200 1121.284 ms - 88 {"status":0,"value":{"ELEMENT":"32"},"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/element/32/click {"id":"32"}
info: [debug] Pushing command to appium work queue: "au.tapById('32')"
info: [debug] Sending command to instruments: au.tapById('32')
info: [debug] [INST] 2015-07-16 10:43:09 +0000 Debug: Got new command 72 from instruments: au.tapById('32')
info: [debug] [INST] 2015-07-16 10:43:09 +0000 Debug: evaluating au.tapById('32')
info: [debug] [INST] 2015-07-16 10:43:09 +0000 Debug: target.frontMostApp().windows()[1].toolbars()[0].buttons()[0].tap()
info: [debug] [INST] 2015-07-16 10:43:10 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-07-16 10:43:10 +0000 Debug: responding with:
info: [debug] [INST] 2015-07-16 10:43:10 +0000 Debug: Running system command #73: /usr/local/Cellar/node/0.12.2_1/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/element/32/click 200 1214.798 ms - 74 {"status":0,"value":"","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/timeouts/implicit_wait {"ms":0}
info: [debug] Set iOS implicit wait to 0ms
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- POST /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/timeouts/implicit_wait 200 0.988 ms - 76 {"status":0,"value":null,"sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: --> GET /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/context {}
info: [debug] Responding to client with success: {"status":0,"value":"NATIVE_APP","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}
info: <-- GET /wd/hub/session/35851ce5-4f15-4d8e-aa1e-7eec63c04d15/context 200 1.135 ms - 84 {"status":0,"value":"NATIVE_APP","sessionId":"35851ce5-4f15-4d8e-aa1e-7eec63c04d15"}

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
SrinivasanTargetcommented, Jan 8, 2017

@derunewige This hasn’t been supported yet by WedDriverAgent. It’s not a bug here, you can raise it in server for feature request.

0reactions
derunewigecommented, Jan 8, 2017

Sorry, i was in a hurry and totally forgot about error logs =/

Appium log:

[HTTP] <-- GET /wd/hub/session/31391924-1869-45fc-bd37-e615d85c59ef/element/EEE46ABE-5F69-49B1-8501-CC6B194AC2FC/displayed 200 1553 ms - 76 
[HTTP] --> POST /wd/hub/session/31391924-1869-45fc-bd37-e615d85c59ef/execute {"script":"env.sendKeyStrategy = 'grouped'","args":[]}
[debug] [MJSONWP] Calling AppiumDriver.execute() with args: ["env.sendKeyStrategy = 'grouped'",[],"31391924-1869-45fc-bd37-e615d85c59ef"]
[debug] [XCUITest] Executing command 'execute'
[HTTP] <-- POST /wd/hub/session/31391924-1869-45fc-bd37-e615d85c59ef/execute 501 4 ms - 112 
[HTTP] --> GET /wd/hub/session/31391924-1869-45fc-bd37-e615d85c59ef/screenshot {}

error stacktrace: gist

  • Appium version (or git revision) that exhibits the issue: 1.6.3
  • Desktop OS/version used to run Appium: OS X 10.12.2
  • Node.js version (unless using Appium.app|exe): 6.9.1
  • Mobile platform/version under test: iOS 10.0
  • Real device or emulator/simulator: simulator
  • Appium CLI or Appium.app|exe: Appium CLI
  • Coding language: java-client 5.0.0-BETA1
Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding SendKeyStrategy capability/using specific strategy ...
Issue: sendKeyStrategy - is it possible to apply a different strategy for each sendKeys? ... I use sendKeyStrategy - setValue throughout the app, ......
Read more >
Appium XCUITest iOSDriver sendkeys() not working
I've tried all the different sendKeyStratey capabilities and still nothing. I've tried different iOS simulators and appium/safari versions, and ...
Read more >
Selenium SendKeys : All You Need To Know - LambdaTest
In this article, we'll delve into how Selenium helps us pass values to text fields using the Selenium sendKeys() method.
Read more >
Advanced Desired Capabilities | Sauce Labs
At the beginning of each session, Appium stops the application ... You can also change the strategy that Appium uses to send keys...
Read more >
[Solved]-How to make appium tests run faster on iOS?
You can set the iOS capability of sendKeyStrategy to setValue instead of the ... Use setValue instead of sendKeys; Stop using Xpath locator...
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