send keys clear the text field after typing in mobile safari
See original GitHub issueThe 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] [35m[HTTP][39m [90m{"using":"xpath","value":"//input[@aria-label='login-email-id']"}[39m
[debug] [35m[W3C (e7e62ff4)][39m Calling AppiumDriver.findElement() with args: ["xpath","//input[@aria-label='login-email-id']","e7e62ff4-7f92-4fcf-a985-d133e9717e25"]
[debug] [35m[XCUITest][39m Executing command 'findElement'
[debug] [35m[BaseDriver][39m Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [35m[BaseDriver][39m Waiting up to 15000 ms for condition
[debug] [35m[RemoteDebugger][39m Executing 'find_element' atom in default context
[debug] [35m[RemoteDebugger][39m Garbage collecting with 5000ms timeout
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{}'
[debug] [35m[RemoteDebugger][39m Original command: garbageCollect
[debug] [35m[RemoteDebugger][39m Garbage collection successful
[debug] [35m[RemoteDebugger][39m Sending javascript command (function(){return function(){var k=this;functi...
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{"status":0,"value":{"ELEMENT":":wdc:1565717462...'
[debug] [35m[RemoteDebugger][39m Original command: sendJSCommand
[debug] [35m[RemoteDebugger][39m Received result for atom 'find_element' execution: {"ELEMENT":":wdc:1565717462767"}
[debug] [35m[W3C (e7e62ff4)][39m Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"5008"}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element [39m[32m200[39m [90m54 ms - 56[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element/5008/value[39m
[info] [35m[HTTP][39m [90m{"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"]}[39m
[debug] [35m[W3C (e7e62ff4)][39m 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] [35m[XCUITest][39m Executing command 'setValue'
[debug] [35m[RemoteDebugger][39m Executing 'click' atom in default context
[debug] [35m[RemoteDebugger][39m Garbage collecting with 5000ms timeout
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{}'
[debug] [35m[RemoteDebugger][39m Original command: garbageCollect
[debug] [35m[RemoteDebugger][39m Garbage collection successful
[debug] [35m[RemoteDebugger][39m Sending javascript command (function(){return function(){var h,aa=this;fun...
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{"status":0,"value":null}'
[debug] [35m[RemoteDebugger][39m Original command: sendJSCommand
[debug] [35m[RemoteDebugger][39m Received result for atom 'click' execution: null
[debug] [35m[RemoteDebugger][39m Executing 'type' atom in default context
[debug] [35m[RemoteDebugger][39m Garbage collecting with 5000ms timeout
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{}'
[debug] [35m[RemoteDebugger][39m Original command: garbageCollect
[debug] [35m[RemoteDebugger][39m Garbage collection successful
[debug] [35m[RemoteDebugger][39m Sending javascript command (function(){return function(){var h,aa=this;fun...
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{"status":0,"value":null}'
[debug] [35m[RemoteDebugger][39m Original command: sendJSCommand
[debug] [35m[RemoteDebugger][39m Received result for atom 'type' execution: null
[debug] [35m[W3C (e7e62ff4)][39m Responding to client with driver.setValue() result: null
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element/5008/value [39m[32m200[39m [90m114 ms - 14[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element[39m
[info] [35m[HTTP][39m [90m{"using":"xpath","value":"//input[@aria-label='login-email-id']"}[39m
[debug] [35m[W3C (e7e62ff4)][39m Calling AppiumDriver.findElement() with args: ["xpath","//input[@aria-label='login-email-id']","e7e62ff4-7f92-4fcf-a985-d133e9717e25"]
[debug] [35m[XCUITest][39m Executing command 'findElement'
[debug] [35m[BaseDriver][39m Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [35m[BaseDriver][39m Waiting up to 15000 ms for condition
[debug] [35m[RemoteDebugger][39m Executing 'find_element' atom in default context
[debug] [35m[RemoteDebugger][39m Garbage collecting with 5000ms timeout
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{}'
[debug] [35m[RemoteDebugger][39m Original command: garbageCollect
[debug] [35m[RemoteDebugger][39m Garbage collection successful
[debug] [35m[RemoteDebugger][39m Sending javascript command (function(){return function(){var k=this;functi...
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{"status":0,"value":{"ELEMENT":":wdc:1565717462...'
[debug] [35m[RemoteDebugger][39m Original command: sendJSCommand
[debug] [35m[RemoteDebugger][39m Received result for atom 'find_element' execution: {"ELEMENT":":wdc:1565717462767"}
[debug] [35m[W3C (e7e62ff4)][39m Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"5009"}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element [39m[32m200[39m [90m59 ms - 56[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element/5009/value[39m
[info] [35m[HTTP][39m [90m{"id":"5009","text":"","value":[""]}[39m
[debug] [35m[W3C (e7e62ff4)][39m Calling AppiumDriver.setValue() with args: [[""],"5009","e7e62ff4-7f92-4fcf-a985-d133e9717e25"]
[debug] [35m[XCUITest][39m Executing command 'setValue'
[debug] [35m[RemoteDebugger][39m Executing 'click' atom in default context
[debug] [35m[RemoteDebugger][39m Garbage collecting with 5000ms timeout
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{}'
[debug] [35m[RemoteDebugger][39m Original command: garbageCollect
[debug] [35m[RemoteDebugger][39m Garbage collection successful
[debug] [35m[RemoteDebugger][39m Sending javascript command (function(){return function(){var h,aa=this;fun...
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{"status":0,"value":null}'
[debug] [35m[RemoteDebugger][39m Original command: sendJSCommand
[debug] [35m[RemoteDebugger][39m Received result for atom 'click' execution: null
[debug] [35m[RemoteDebugger][39m Executing 'type' atom in default context
[debug] [35m[RemoteDebugger][39m Garbage collecting with 5000ms timeout
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [35m[RemoteDebugger][39m Found data handler for response
[debug] [35m[RemoteDebugger][39m Received data response from socket send: '{}'
[debug] [35m[RemoteDebugger][39m Original command: garbageCollect
[debug] [35m[RemoteDebugger][39m Garbage collection successful
[debug] [35m[RemoteDebugger][39m Sending javascript command (function(){return function(){var h,aa=this;fun...
[debug] [35m[RemoteDebugger][39m Sending '_rpc_forwardSocketData:' message to remote debugger[info] [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session/e7e62ff4-7f92-4fcf-a985-d133e9717e25/element[39m
Code To Reproduce Issue [ Good To Have ]
input.click();
input.clear();
Thread.sleep(1000);
input.sendKeys(username);
input.sendKeys(Keys.TAB);
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:24 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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);
Closed as not an issue