I am using com.jidesoft.combobox.CheckBoxListComboBox
I made the selection of the checkboxes programatically with
int[] indecesToSelect =..
combo.setSelectedIndices(indecesToSelect);
But i dont see any way to unselect any selection.
I tried
combo.setSelectedItem(item, false);
But this is not unselecting , this is also selecting
Also tried
combo.getList().clearSelection();
no effect
Please help
use combo.setSelectedIndex(-1); to unselect.
Source
Related
I have tried all the possible things. also, tried searching over tried different combinations and variations. I can get the element clicked which opens the dropdown. but i am not able to select an option in it. I tried with actions, sendkeys, keys.down/enter and multiple things as well. however, it didn't help. That's the only thing I am stuck on.
//selecting office
1.driver.findElement(By.id("DG5QEPn")).click();
Actions actions = new Actions(driver); actions.moveToElement(driver.findElement(By.xpath("//*[#id="DG5QEPn"]/div/div/div1/div1"))).click();
driver.findElement(By.id("DG5QEPn")).click();
driver.findElement(By.id("DG5QEPn")).sendKeys("RTP HQ"); driver.findElement(By.id("DG5QEPn")).sendKeys(Keys.Down); driver.findElement(By.id("DG5QEPn")).sendKeys(Keys.Enter);
Html-
In the below image.
You should enumerate through all of the options then click on the one you want. Take a look at this.
EDIT
The easiest way that I have found was to do something along the lines of:
el = driver.find_element_by_id('id_of_select')
for option in el.find_elements_by_tag_name('option'):
if option.text == 'The Options I Am Looking For':
option.click() # select() in earlier versions of webdriver
break
Below code worked for me
WebElement selectMyElement = driver.findElement(this.getObject(By.Id("Id of Your DropDown")));
selectMyElement.click();
Actions keyDown = new Actions(driver);
keyDown.sendKeys(Keys.chord(Keys.DOWN, Keys.DOWN, Keys.ENTER)).perform();
I create EditText programmatically.
Following is my code:
mEditText = new EditText(mMainActivity);
mEditText.setVisibility(View.INVISIBLE);
mEditText.setTextSize(8);
mEditText.setSingleLine();
mEditText.setMaxLines(1);
mEditText.setLines(1);
mEditText.setVerticalScrollBarEnabled(false);
What I set above seems completely useless...Please help me.
You can try setMovementMethod() It will disable the EditText text scrolling. But you have to manage text size.
eText.setMovementMethod(null);
Hope it will help you...
Set below properties:
mEditText.setSingleLine(true);
mEditText.setHorizontallyScrolling(true);
It will work.
What input type do you want?
editText.setInputType(InputType.TYPE_**);
if email/phone you do not even need the
editText.setLines(1);
editText.setMaxLines(1);
Also note your method
editText.setSingleLine(false);
May be changing the values on your maxLines and Lines methods.
I have a checkbox in a panel.If I click in that checkBox it should be saved.Iam not knowing what should I use.Can anyone suggest me with the right code.Thanks in advance.
Here is my code.
my checkbox name is--check;
my checkbox value is---checkvalue;
my database key is----abc;
Boolean selected=checkvalue.getInt(boolean);
if(selected==null){
abc.setcheckValue(null);
}else{
abc.setcheckvalue(selected.getInt(boolean);
Here I want to use other code instead of getInt(boolean).Can anyone suggest
I'm new to robotium and i'm trying to write a quick and dirty script to run through all screens in an app.
The problem i have mainly with the 'home button' in the app. I've tried lots of options but i cant seem to get it to click there except with index, which is not what i want.
When i check out the button with the hierarchyviewer it looks like this:
Link
However when i try for example:
assertTrue(
"Wait for text (id: myapp.R.id.home) failed.",
solo.waitForImageById("myapp.R.id.home", 20000));
solo.clickOnImage((ImageView) solo.findViewById("myapp.R.id.home"));
solo.waitForActivity("MenuActivity");
It fails at the waitForImageByID line. Ive tried multiple options like waitForImageButton etc, but i just cant seem to get it clicked. What am i missing here?
junit.framework.AssertionFailedError: View with id: '0' is not found!
at com.jayway.android.robotium.solo.Solo.getView(Solo.java:1990)
at com.jayway.android.robotium.solo.Solo.getView(Solo.java:1970)
at com.bitbar.recorder.extensions.OtherUtils.a(OtherUtils.java:246)
at com.bitbar.recorder.extensions.OtherUtils.b(OtherUtils.java:241)
at com.bitbar.recorder.extensions.v.a(Waiter.java:71)
at com.bitbar.recorder.extensions.ExtSolo.waitForImageButtonById(ExtSolo.java:4176)
at com.example.android.apis.test.Test.testRecorded(Test.java:137)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1740)
Use the following line to press the home button in the action bar
solo.clickOnActionBarHomeButton();
The issue is that the id that it is referring is not in your application, it is in androids default R file, try android.R.id.home and it should work fine. It is worth noting though that if your application uses action bar sherlock to support the action bar pre 4.0 that this will have a different ID there and you will have to handle this in your test.
You can see this for yourself looking at: http://developer.android.com/reference/android/R.id.html
When you are using ActionBarSherlock there are two different Ids you have to check, android.R.id.home for API-Level>11 and abs__home for lower levels (provided by ActionBarSherlock):
View homeButton = activity.findViewById(android.R.id.home);
if (homeButton == null) {
homeButton = activity.findViewById(R.id.abs__home);
}
What about this code:
ArrayList<LinearLayout> ll = solo.getCurrentViews(LinearLayout.class);
//You can change 1 with the ordinal number of LinearLayout you want to click.
solo.clickOnView(ll.get(1));
or also
ArrayList<ImageView> iv = solo.getCurrentViews(ImageView.class);
//You can change 0 with the ordinal number of Image you want to click.
solo.clickOnView(iv.get(0));
I think if you identify the correct id for view or linear layout or image view it should work.
Dave C's answer was working only partially for me. The button was clicked but before the preceding screen was loaded assertions had started and thus were always false. The solution is to run "home click" on the main thread (Robotium 5.2.1):
getInstrumentation().runOnMainSync(new Runnable() {
#Override
public void run() {
solo.clickOnActionBarHomeButton();
}
});
From your question I can see that it is an image view. You can click on any view using the following piece of code.
View view = solo.getView("View_name_from_hierachy_viewer");
solo.clickOnView(view);
View_name_from_hierachy_viewer in your case will be "home".
Let me know if this does not work.
i tried to do that while js is creating a timetable... it shows spinner loading..
i tried to do this $.mobile.pageLoading(); $.mobile.pageLoading(true); and also tried to use this plugin http://contextllc.com/tools/jQuery-showLoading
The result is the same.. it shows spinner after he generate time table.. and i don't know why...here is where i tried to use it...
$('#timeDropList').change(function() {
$.mobile.pageLoading(false);
$('div.addedEntry').remove();
drawTemplate();
});
Are you using the right version of jQuery Mobile? Looks like they took away the pageLoading method in 1.0b1 in favor of two separate methods: showPageLoadingMsg and hidePageLoadingMsg. The last reference I see to pageLoading is in 1.0a4.1.
$('#home').live('pagebeforecreate',function(event){
alert('This page was just enhanced by jQuery Mobile!');
$.mobile.loadingMessage = "pagebeforeshow Page...";
$.mobile.showPageLoadingMsg();
});