Cannot set element values correctly when accessing using accessibility labels

295 views
Skip to first unread message

Subhash Daga

unread,
Apr 18, 2014, 2:46:58 PM4/18/14
to appium-...@googlegroups.com
 

I'm using Appium to automate testing of iOS native app. I have everything setup and run the test using Java. However, I'm running into some issue with trying to input textfield values.

I'm accessing the textfield elements using accessibility labels (By.name) and setting the values as below -

driver.findElement(By.name("emailTextField")).sendKeys("myusername");
driver.findElement(By.name("passwordTextField")).sendKeys("mypasswd");

Below is the screenshot once the values have been set. You will notice that the placeholder text for the text fields is still there behind and the password value is not secure. But the real issue is that the login fails

http://i.imgur.com/WMnoNgK.png

Now, if I change my code and access element using tag names, I don't see any placeholder texts, password value is secure and I can login.

driver.findElement(By.tagName("textfield")).sendKeys("myusername");
driver.findElement(By.tagName("secure")).sendKeys("mypasswd");

My question is that - I want to use accessibility labels (By.name) and not sure how to get it to work correctly. Thanks.


bootstrap online

unread,
Apr 18, 2014, 2:52:05 PM4/18/14
to Subhash Daga, appium-...@googlegroups.com


--
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.
For more options, visit https://groups.google.com/d/optout.

bootstrap online

unread,
Apr 18, 2014, 3:23:54 PM4/18/14
to appium-...@googlegroups.com
I think the fix is to have the java bindings offer a namedTextfield helper. I suggest opening an issue here:
https://github.com/appium/java-client


On Fri, Apr 18, 2014 at 3:17 PM, Subhash Daga <subhas...@gmail.com> wrote:
Ah, so the issue is that the table cell that contains the textfield also has the same accessibility label. But I'm not sure what the work around is in the java code. What I did try is assign a accessibility label to the table cell (emailTableCell) and then do the following -

driver.findElement(By.name("emailTableCell")).findElement(By.name("emailTextField")).sendKeys("myusername");

That seems to work. But not if there is a better way around. Thanks.
Reply all
Reply to author
Forward
0 new messages