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.

send keys clear the text field after typing in mobile safari

See original GitHub issue

The problem

I’m facing issue with safari browser on ios simulator. Please help to fix this issue!! I tried the following ways, but no luck.

input.click();
input.clear();
Thread.sleep(1000);
input.sendKeys(username);
input.sendKeys(Keys.TAB); not working

((JavascriptExecutor) driver).executeScript("console.log(arguments[0]); $(arguments[0]).change(); return true;", input); not working

The value is sent but cleared right away.

Environment

  • Appium version that exhibits the issue: 1.10.0
  • Mac OS High Sierra 10.13.6
  • Node.js version (unless using Appium.app|exe):
  • Npm or Yarn package manager: 6.5.0
  • Mobile platform/version under test: iOS 12.0
  • Real device or emulator/simulator: iphone X simulator
  • Appium CLI or Appium.app|exe:

Link to Appium logs

[info] [HTTP] {"using":"xpath","value":"//input[@aria-label='login-email-id']"}
[debug] [W3C (e7e62ff4)] Calling AppiumDriver.findElement() with args: ["xpath","//input[@aria-label='login-email-id']","e7e62ff4-7f92-4fcf-a985-d133e9717e25"]
[debug] [XCUITest] Executing command 'findElement'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 15000 ms for condition
[debug] [RemoteDebugger] Executing 'find_element' atom in default context
[debug] [RemoteDebugger] Garbage collecting with 5000ms timeout
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{}'
[debug] [RemoteDebugger] Original command: garbageCollect
[debug] [RemoteDebugger] Garbage collection successful
[debug] [RemoteDebugger] Sending javascript command (function(){return function(){var k=this;functi...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"status":0,"value":{"ELEMENT":":wdc:1565717462...'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'find_element' execution: {"ELEMENT":":wdc:1565717462767"}
[debug] [W3C (e7e62ff4)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"5008"}
[info] [HTTP] <-- POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element 200 54 ms - 56
[info] [HTTP] 
[info] [HTTP] --> POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element/5008/value
[info] [HTTP] {"id":"5008","text":"auto_preferred_01@sothebysqa.com","value":["a","u","t","o","_","p","r","e","f","e","r","r","e","d","_","0","1","@","s","o","t","h","e","b","y","s","q","a",".","c","o","m"]}
[debug] [W3C (e7e62ff4)] Calling AppiumDriver.setValue() with args: [["a","u","t","o","_","p","r","e","f","e","r","r","e","d","_","0","1","@","s","o","t","h","e","b","y","s","q","a",".","c","o","m"],"5008","e7e62ff4-7f92-4fcf-a985-d133e9717e25"]
[debug] [XCUITest] Executing command 'setValue'
[debug] [RemoteDebugger] Executing 'click' atom in default context
[debug] [RemoteDebugger] Garbage collecting with 5000ms timeout
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{}'
[debug] [RemoteDebugger] Original command: garbageCollect
[debug] [RemoteDebugger] Garbage collection successful
[debug] [RemoteDebugger] Sending javascript command (function(){return function(){var h,aa=this;fun...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"status":0,"value":null}'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'click' execution: null
[debug] [RemoteDebugger] Executing 'type' atom in default context
[debug] [RemoteDebugger] Garbage collecting with 5000ms timeout
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{}'
[debug] [RemoteDebugger] Original command: garbageCollect
[debug] [RemoteDebugger] Garbage collection successful
[debug] [RemoteDebugger] Sending javascript command (function(){return function(){var h,aa=this;fun...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"status":0,"value":null}'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'type' execution: null
[debug] [W3C (e7e62ff4)] Responding to client with driver.setValue() result: null
[info] [HTTP] <-- POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element/5008/value 200 114 ms - 14
[info] [HTTP] 
[info] [HTTP] --> POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element
[info] [HTTP] {"using":"xpath","value":"//input[@aria-label='login-email-id']"}
[debug] [W3C (e7e62ff4)] Calling AppiumDriver.findElement() with args: ["xpath","//input[@aria-label='login-email-id']","e7e62ff4-7f92-4fcf-a985-d133e9717e25"]
[debug] [XCUITest] Executing command 'findElement'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 15000 ms for condition
[debug] [RemoteDebugger] Executing 'find_element' atom in default context
[debug] [RemoteDebugger] Garbage collecting with 5000ms timeout
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{}'
[debug] [RemoteDebugger] Original command: garbageCollect
[debug] [RemoteDebugger] Garbage collection successful
[debug] [RemoteDebugger] Sending javascript command (function(){return function(){var k=this;functi...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"status":0,"value":{"ELEMENT":":wdc:1565717462...'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'find_element' execution: {"ELEMENT":":wdc:1565717462767"}
[debug] [W3C (e7e62ff4)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"5009"}
[info] [HTTP] <-- POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element 200 59 ms - 56
[info] [HTTP] 
[info] [HTTP] --> POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element/5009/value
[info] [HTTP] {"id":"5009","text":"","value":[""]}
[debug] [W3C (e7e62ff4)] Calling AppiumDriver.setValue() with args: [[""],"5009","e7e62ff4-7f92-4fcf-a985-d133e9717e25"]
[debug] [XCUITest] Executing command 'setValue'
[debug] [RemoteDebugger] Executing 'click' atom in default context
[debug] [RemoteDebugger] Garbage collecting with 5000ms timeout
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{}'
[debug] [RemoteDebugger] Original command: garbageCollect
[debug] [RemoteDebugger] Garbage collection successful
[debug] [RemoteDebugger] Sending javascript command (function(){return function(){var h,aa=this;fun...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"status":0,"value":null}'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'click' execution: null
[debug] [RemoteDebugger] Executing 'type' atom in default context
[debug] [RemoteDebugger] Garbage collecting with 5000ms timeout
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{}'
[debug] [RemoteDebugger] Original command: garbageCollect
[debug] [RemoteDebugger] Garbage collection successful
[debug] [RemoteDebugger] Sending javascript command (function(){return function(){var h,aa=this;fun...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger[info] [HTTP] --> POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element

Code To Reproduce Issue [ Good To Have ]

input.click();
input.clear();
Thread.sleep(1000);
input.sendKeys(username);
input.sendKeys(Keys.TAB);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Summerxia88commented, Sep 17, 2019

@imurchie I’m still facing the issue with mobile safari browser. Look like the input can’t be saved and wiped once cursor moved to the other field. Code is as below: input.click(); input.clear(); Thread.sleep(1000); input.sendKeys(username); input.sendKeys(Keys.TAB);

input.click(); input.clear(); Thread.sleep(1000); input.sendKeys(password); input.sendKeys(Keys.TAB);

0reactions
mykola-mokhnachcommented, Sep 5, 2021

Closed as not an issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS Safari input typing issue when clear value - Stack Overflow
Type some text and tap the clear button, and then programmatically return focus to the input, I won't be able to continue typing....
Read more >
Keyboard shortcuts and gestures in Safari on Mac
Shift-Command-Return after typing in the Smart Search field. Go to the next tab. Control-Tab or Shift-Command-]. Go to the previous tab.
Read more >
How to click Enter after entering some text - Appium Discuss
I am able to enter text in a text a text field, and trying to enter click enter by following code: element.sendKeys("Some text");...
Read more >
Selenium SendKeys : All You Need To Know - LambdaTest
Next, let us consider a scenario where we need to verify that we are able to clear or delete the string entered in...
Read more >
<input type="password"> - HTML: HyperText Markup Language
Some browsers display the typed character for a moment before obscuring it, while others allow the user to toggle the display of plain-text...
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