Android Driver not able to click

86 views
Skip to first unread message

Arun Wadhwa

unread,
Jul 19, 2012, 12:32:30 AM7/19/12
to webd...@googlegroups.com
Hi,
 I am running my test cases in Android3.2. Able to run the test cases. But in one scenario when I put one String in TextBox the functionality of the applications gives suggestion as list.
 In FF,IE,Chrome I am able to click the first element in list where as I am not able to click in Android.

I tried with Keyboard options, Mouse option. putting the exact string and submit . But no luck

Can anyone faced this issue or can help me out

Thanks
Arun

alladi sai

unread,
Jul 19, 2012, 6:51:20 AM7/19/12
to webd...@googlegroups.com
Hi ,

There is a problem in Android to select the element in the list using the element.SlectByText / index,

Instaed you need to use the javascript to do it.

Please find the below javascript which will solve your problem

"ItemValue" is the name of the item.

  string scrpt = "try { var flag=false; var listLength = arguments[0].options.length; for (var i = 0; i < listLength; i++)" +
                                             " { if (arguments[0].options[i].text == arguments[1]) " +
                                             " { arguments[0].options[i].selected = true; flag=true; break; } } return flag;} catch(ex){return false;}";

            Boolean scriptRet = (Boolean)((OpenQA.Selenium.IJavaScriptExecutor)driver).ExecuteScript(scrpt, element, ItemValue);


Regard's

Sai 


Arun

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.



--
Regard's

Sai..
Reply all
Reply to author
Forward
0 new messages