secure text field - java binding

492 views
Skip to first unread message

Mayank Solanki

unread,
Mar 23, 2013, 9:47:45 AM3/23/13
to appium-...@googlegroups.com
Hiya,

I am trying to enter some text in secureTextField, but am not able to.
Entering text into textField is working perfectly fine.

Here's the code I am using - 

WebElement password = driver.findElement(By.name("password"));

password.sendKeys("text123");


I also tried it the other way - 


WebElement password = driver.findElement(By.tagName("secure"));

password.sendKeys("text123");

I am not seeing any exception when I try to do this, but sendKeys is not entering any value in the secure text field the way it does for text field.


Help please!


Thanks,

Mayank

Shawn Knight

unread,
Mar 24, 2013, 8:19:20 PM3/24/13
to appium-...@googlegroups.com
Try this: 

WebElement password = driver.findElement(By.tagName("UIASecureTextField"));

Mayank Solanki

unread,
Mar 25, 2013, 6:42:11 AM3/25/13
to appium-...@googlegroups.com
Hi Shawn,

That doesn't work either. Both By.tagName("secure") and By.tagName("UIASecureTextField"does find the password field, but the problem is the sendKeys is not typing in the value :S

Wondering what's going wrong there.

Thanks,

Mayank

Tomasz Borys

unread,
Mar 25, 2013, 6:54:31 AM3/25/13
to Mayank Solanki, appium-...@googlegroups.com
Hi Mayank,

Could you tell me what is the output on appium server when the command is pushed to appium work queue? 

Is there a problem with finding the field or setting the value for that specific field? 

Cheers,
Tom




--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Mayank Solanki

unread,
Mar 25, 2013, 7:58:53 AM3/25/13
to appium-...@googlegroups.com, Mayank Solanki
Hi Tomasz,

The problem is with setting the value for that specific field.

Following is the appium server output. I have copied the out for username and password field, but for username field, things are working fine.

info: [INST] 2013-03-25 11:00:29 +0000 Default: Got new command from instruments: au.getElement('2').setValueByType('a...@gmail.com')


info: [INST] 2013-03-25 11:00:29 +0000 Debug: (null).tap()

       2013-03-25 11:00:29 +0000 Debug: (null).tap()

2013-03-25 11:00:29 +0000 Debug: target.frontMostApp().keyboard().typeString("a...@gmail.com")

2013-03-25 11:00:31 +0000 Default: Command executed without response


info: [INST] 2013-03-25 11:00:31 +0000 Default: Result is not protocol compliant, wrapping


info: [INSTSERVER] Socket data received (48 bytes)


debug: Appium request initiated at /wd/hub/session/e3069673-af03-40e5-a754-af69028a5322/element


info: [INSTSERVER] Socket data being routed for 'cmd' event

info: [INSTSERVER] Got result from instruments: {"status":0,"value":""}

info: Responding to client with success: {"status":0,"value":"","sessionId":"e3069673-af03-40e5-a754-af69028a5322"}

POST /wd/hub/session/e3069673-af03-40e5-a754-af69028a5322/element/2/value 200 2933ms - 87

info: [INSTSERVER] Sending command to instruments: au.getElementByName('password')

info: Pushed command to appium work queue: au.getElementByName('password')


debug: Request received with params: {"using":"name","value":"password"}


info: [INST] 2013-03-25 11:00:32 +0000 Default: Got new command from instruments: au.getElementByName('password')


info: [INST] 2013-03-25 11:00:32 +0000 Default: Lookup returned [object UIASecureTextField] with the name "password" (id: 3).


info: [INSTSERVER] Socket data received (61 bytes)


info: [INSTSERVER] Socket data being routed for 'cmd' event

info: [INSTSERVER] Got result from instruments: {"status":0,"value":{"ELEMENT":"3"}}

info: Responding to client with success: {"status":0,"value":{"ELEMENT":"3"},"sessionId":"e3069673-af03-40e5-a754-af69028a5322"}

POST /wd/hub/session/e3069673-af03-40e5-a754-af69028a5322/element 200 1179ms - 109


debug: Appium request initiated at /wd/hub/session/e3069673-af03-40e5-a754-af69028a5322/element/3/value


info: [INSTSERVER] Sending command to instruments: au.getElement('3').setValueByType('test123')

info: Pushed command to appium work queue: au.getElement('3').setValueByType('test123')


debug: Request received with params: {"id":"3","value":["test123"]}


info: [INST] 2013-03-25 11:00:33 +0000 Default: Got new command from instruments: au.getElement('3').setValueByType('test123')


info: [INST] 2013-03-25 11:00:33 +0000 Debug: (null).tap()

       2013-03-25 11:00:33 +0000 Default: Command executed without response


info: [INST] 2013-03-25 11:00:33 +0000 Default: Result is not protocol compliant, wrapping


info: [INSTSERVER] Socket data received (48 bytes)


info: [INSTSERVER] Socket data being routed for 'cmd' event

info: [INSTSERVER] Got result from instruments: {"status":0,"value":""}

info: Responding to client with success: {"status":0,"value":"","sessionId":"e3069673-af03-40e5-a754-af69028a5322"}

POST /wd/hub/session/e3069673-af03-40e5-a754-af69028a5322/element/3/value 200 1058ms - 87


debug: Appium request initiated at /wd/hub/session/e3069673-af03-40e5-a754-af69028a5322/element


info: [INSTSERVER] Sending command to instruments: au.getElementByName('Login')

info: Pushed command to appium work queue: au.getElementByName('Login')


debug: Request received with params: {"using":"name","value":"Login"}


info: [INST] 2013-03-25 11:00:34 +0000 Default: Got new command from instruments: au.getElementByName('Login')


info: [INST] 2013-03-25 11:00:34 +0000 Default: Lookup returned [object UIANavigationBar] with the name "Login" (id: 4).


info: [INSTSERVER] Socket data received (61 bytes)

Tomasz Borys

unread,
Mar 25, 2013, 8:11:06 AM3/25/13
to Mayank Solanki, appium-...@googlegroups.com
Hi Mayank,

I see you have .setValueByType('test123')
I had similar problem that field wasn't populated because of that change. In the previous version of appium it worked fine cause it was just 'setValue'. I asked why the change was implemented but haven't received answer yet, so for a temporary solution - I changed that in appium in my local files. 
If you want to check out this solution, do the following:
1. Open ios.js file (Appium/app/ios.js)
2. change line:
 var command = ["au.getElement('", elementId, "').setValueByType('", value, "')"].join('');
to
 var command = ["au.getElement('", elementId, "').setValue('", value, "')"].join('');

I am not saying that it's perfect solution but I work around my problem and so far didn't have issues because of that. 

Hope this helps!

Cheers,
Tomasz

Mayank Solanki

unread,
Mar 25, 2013, 8:22:29 AM3/25/13
to appium-...@googlegroups.com, Mayank Solanki
cool stuff. Thanks Tomasz!

Ramdas Krishna Baliga

unread,
Mar 4, 2014, 5:09:22 AM3/4/14
to appium-...@googlegroups.com, Mayank Solanki
Hi,
 Following code worked for me - [when I used downloaded 0.15.0  Appium app]

 WebElement pwd = (new WebDriverWait(driver, 30)).until(ExpectedConditions.presenceOfElementLocated(By.name("Password")));

  pwd.click();

  List<WebElement> pwdList = driver.findElements(By.tagName("secure"));

  pwdList.get(0).sendKeys("test");

  pwdList.get(1).sendKeys("test");


But before I tried this, I was trying to fix it in appium code as mentioned by Tomasz ...

But I got

info: [INST] 2014-03-04 09:50:15 +0000 Error: Script threw an uncaught JavaScript error: Error getting next command, shutting down :-( on line 71 of bootstrap.js

When I tried to run from latest git cloned  code. [using iOS 7, Mac 10.8.8 and Xcode 5.2]

What could be the issue .. ?

~Ramdas
Reply all
Reply to author
Forward
0 new messages