How can i use id to do action on an object of an android using Robotium tool? - robotium

I tried to use id to click on the object in an android application but when i enter solo.clickOnImageButton(R.id.action_menu_search); It is showing an error, that action_menu_search cannot be resolved or not a field. How can i use the id of an object to click on the same.
Thank you in advance,
With regards,
David Gayler

Use solo.clickOnView(solo.getView(int id));

Method clickOnImageButton takes parameter as index, not id, so you should use method, which Renas has mentioned.

Related

How to find an element containing #nbsp; in text?

I've an element with html -
<h3>App-1 Playground Login</h3>
I want to identify it with entire text - App-1 Playground Login, but causing issues to identify it. Please help how this element can be identified.
Please use the below xpath. I have already tested that and it is working fine. In the second argument of the translate method you need to type "ALT+0160" and in the third argument you will have to put just a normal space.
//h3[contains(translate(text(),' ',' ' ), 'App-1 Playground Login')]
One of the way to select your title could be :
//h3[text()= concat('App-1 Playground',codepoints-to-string(160),'Login')]
Works fine on http://xpather.com/

How to write xpath for the on/off button present in a table for which class is compound class

This element can be turned off or on. As the class is compound class, not sure how to write the xpath. So wrote like this
//tr[1]/td[4]/div[1]/div/div/div[#css='div.ios-switch.on']
Screen shots are attached here
Can you help me in writing the xpath for this element
Use this instead - //tr[1]/td[4]/div[1]/div/div/div[#class='ios-switch on']
"#checkbox1011 [class^='ios-switch']"
or
"#checkbox1011 .ios-switch.on,.ios-switch.off"
Try using these CSS selectors.
//div[#id='checkbox1011']//td[#class='ios-switch-on']
Try:
//tr[1]/td[4]/div[1]/div/div/div[#css='.ios-switch.on' or '.ios-switch.off']
Hopefully this should work.
For the above screenshot, let me assume the username as sabrina galloway.
The toggle switch should present in the same row of username column.
You can use xpath like,
.//tr[./descendant::td[contains(.,'sabrina galloy')]/descendant::*[contains(#class,'ios-switch')]/div[#class='handle']
Use //div[starts-with(#class,'ios-switch')]

Make Text Field item as Read Only in APEX 5.0

I have some text field page items on my APEX 5.0 page and I want to make the textboxes as read only/non-editable. During the page load I want to use these text boxes for only the data display on the page and should be non-editable.
Can somebody advice on how to do that? What attributes need to set for this?
This answer is a bit late to the party, but I found myself confronted to this problem and I wanted to share the solution I came up with.
In fact you just need to create your item as a text area, let say P1_Text_Area and you give it a readonly attribute using JavaScript. Write thoses 2 lines in the "Function and Global Variable Declaration" of your page:
var disItem = document.getElementById('P1_Text_Area');
disItem.readOnly = true;
Hope this helps someone in need.
in item properties find the
Read Only group
and set Read Only Condition Type as Always
or the option that suits to you
You can use disabled + save session state ==> read only

Sencha Touch 2 Field Focus

Does anyone know the Sencha Touch 2 equivalent of ExtJS4's:
form.getForm().findField("myfield");
Thanks.
use form.getValues(); assuming you can get the form element... if you needs to do that use refs... on my mobile rigjt now, i can post more sample code later if necessary
I use that way:
var field = vorm.down("textfield[name=username]");
Example:
form.down("selectfield[name=username]").setLabel('User');
form.down("selectfield[name=username]").setValue('email#te');
form.down("selectfield[name=username]").setPlaceHolder('email#test.com');

How can I store a dynamic text value in selenium ide and use it later in different window

I am new in selenium and trying to learning. I am creating a script and I got stuck here, I want to store a dynamic value from text message on web page ex. " Event Name:Test" this Event Name is dynamic and I want to store this and want to get in other window. In 2nd window i want to use this value(Test) to verify in the page
I tried storeValue, StoreText and storeAttribute command and getting error message for xpath or "element not found".
Please help me and advice me , what should I do?
Can You please suggest me the Xpath for storing and retrieving the event name. Please help me...
Thanks in advance,
Niru
If you are using the same test-case to navigate from page 1 to page 2 you can use the storeText function in the IDE to store the value of your event name. And then you can use the same variable in the page 2 for verification.
For example, in page 1 to store the value of event you use:
storeText(locator1, temp)
And then on page 2 you use assert:
assertText(locator2, ${temp})