[vaadin 6][Combobox] Dont show Suggestionbox when no Suggestion is in it - java

Im using Vaadin 6 in our Project and i wanted to use the Combobox as an element for textinput and selection. This is working fine, but i wondered if there is a possibility to not show the suggestion window, if there aren't any suggestion.
(wanted to upload a picture but wasn't allowed to)
I studied the code of the combobox and searched in the web so far for solution, but i could'nt get any infos about this topic.
So does someone has an idea how this might work out?
regards

If the container is empty add your own style to the Combobox:
comboBox.addStyleName( "empty-cb" );
Then add this to the CSS file:
.v-filterselect-suggestpopup-empty-cb {
display: none;
}

Related

Locate an element created by javascript using selenium webdriver

I'm new in Selenium and Java, i'm work in a Automation testing project using selenium (java) , today i have a problem with driver.findElement, the element i want to find was created by javascript, i'm sure about using WebDriverWait to wait to target element to present, even i use thread.sleep and wait for it for about few minutes but webdriver still can not locate that element.
This is my problem, in html/js code i have a button, click this button javascript will create a div and i need use selenium to locate it to make Automatio Testing work.
After click a button, javascript makes a div look like :
<div id="zm-view-frame" class="fade in"><div class="zm-view-header"><div class="zm-view-back"><a onclick="WFLandingpage.closePreview();" id="zm-view-close" class="button" href="javascript:void(0);"><span>Close</span></a></div><div id="zm-view-button"><span>Desktop</span><span>Tablet</span><span>Mobile</span><span>Rotate</span></div></div><iframe id="zm-display-iframe" src="page=mvc_landingpages&act=templatepage&preview=1&templateId=landingpage3" style="padding-top: 63px; margin: 0px auto;" scrolling="yes" width="100%" height="609"></iframe></div>
then, in java code i wrote :
this.wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("zm-view-frame")));
Then :
Tester.Browser.findElement(By.id("zm-view-frame")).click();
of course, i have defined this.wait :
public WebDriverWait wait = new WebDriverWait(Tester.Browser, 100);
and i get a wait timeout exception
I even use many type of By such as Xpath, css selector, class ... but still no luck.
I also use Selenium IDE for firefox to get element, export it to java code and view in my editor then do the same but it's not work for me again.
i'm really stuck on this, can you give me some help ?
and sorry for my bad english, many thanks !
UPDATE - this is my html structure :
html structure
UPDATE - I found the bug and have a solution
Reason : Before above code i have few line of codes to check if a iframe available, the code like :
this.wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(locator));
and i didn't know that code make driver switched to that iframe, so my code above to find element is on wrong place (context).
Solution : so i need to back to defaut context (back to parent), i code like that :
Tester.Browser.switchTo().defaultContent();
Many thank to #Naveen to remind me to check that case :).
I found the bug and have a solution
Reason : Before above code i have few lines of code to check if a iframe available, the code like below :
this.wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(locator));
and i didn't know that code make driver switched to that iframe, so my code above to find element is on wrong place (context).
Solution : so i need to back to defaut context (back to parent), i code like that :
Tester.Browser.switchTo().defaultContent();
Many thank to #Naveen to remind me to check that case :).

Selenium with Java and Eclipse and SmartGWT

first time here and I tried to search for this info, so please forgive if this has been asked before. I am fairly knew to coding/selenium. I don't seem to have an issue with anything other than our SmartGWT screens and wondering if anybody could help with suggestions...I can't seem to get Selenium to work at all withing anything SmartGWT related actually
For example I have a date field and I want to type in a new date
This is the code according to firepath
<input id="isc_B" class="selectItemText" type="TEXT" tabindex="1131"
style="width:66px;height:12px;-moz-user-focus:normal;"
autocomplete="OFF" onselect="if (window.isc_ComboBoxItem_0 == null)
return;isc_ComboBoxItem_0.$54h()"
oninput="isc_ComboBoxItem_0._handleInput()" spellcheck="true"
$377="$378" $376="isc_ComboBoxItem_0" handlenativeevents="false"
name="valueField"/>
According to firepath these are the xpaths for it
[.//*[#id='isc_B']
html/body/div[4]/div[1]/div[2]/div/form/table/tbody[2]/tr[2]/td[1]/input
and I've tried these:
driver.findElement(By.xpath(".//*[#id='isc_B']")).sendKeys...;
driver.findElement(By.xpath("//*[#id='isc_B']")).sendKeys...;
driver.findElement(By.id("isc_B")).sendKeys...;
and can't get anything to recognize. any pointers would be awesome and thank you in advance. Do I need to import specific libraries for smartGWT or something?
Don't go by the XPaths suggested by FirePath..Try to create relative XPaths..Because absolute XPATHs can change..
For the above input tag I would recommend you use something like below
driver.findElement(By.className("selectItemText")).sendKeys("yourDate");
EDIT: Based on your website below is the code which works absolutely fine for me:
WebDriver driver=WebDriverFactory.getBrowser("http://www.tobymob.com/test/test.html");
driver.findElement(By.className("selectItemText")).sendKeys("someDate");

RichFaces: TabPanel and param

Currently, i am dealing with rich:tabPanel in my web application based on JSF 2.0.
I encounter a very strange problem, which is related to my richface component.
Basically, i print some same stuff on each panel (here, it is a schedule table of a show, tab contains the day and content of tab contains the differents hours ).
Consequently, i have something like that:
<rich:tabPanel>
<c:forEach items="#{show}" var="hour" ...>
<rich:tab>
<a4j:commandLink ...>
<a4j:param value="hour.something" assignTo="#{bean.method}" />
</a4j:commandLink>
</ ..... >
When i click on the first commandlink, when my webpage is displayed, it's ok. But when i choose an other tab, and i click on the commandlink, the "bean.method" is not call. I need to click a second time to make the call of the function.
Finally, when i put the tabPanel as "switchtype=server", it works very well (without clicking 2 times).
But that's not the purpose, i want to use the client mode.
I see that on JIRA of richfaces v3, this problem has been solved JIRA JBoss. But there is no more information (except a comment but it's not working).
If anyone can help, it would be great.
Regards,
The problem is you are using nested forms(form within form). This is not recommended in JSF. Even in HTML it is invalid. Remove one form and it will work.
Read this post too.

How can I reenable autocomplete support for just 1 site in my whole struts project?

since I'm trying to solve this problem for some days, I thought about giving you guys a chance. The situation:
We're running a SAP Shop with Java Server Pages and Struts in background. We had to disable the HTML Header setable Cache with:
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Expires", "0");
Now what I want to do seemed to us as a simple task but turned out to be more scientific than we expected.
We want to turn auto-complete for IE back on just for the login page. What I and my colleague tried were simple approaches like resetting the header values to various "should be caching" values like 'public' with expirens tomorrow or sth. Neither did anything give us that auto-complete boxes in IE6 and up.
So does anyone know a method for JUST ONE PAGE in a Struts system to turn the caching & as we think the autocomplete back on?
I don't think autocomplete has anything to do with the caching response headers. autocomplete is on by default, and can be disabled on a specific form field using autocomplete="off". If you have such an attribute in your login form fields, then just remove it.
See How do you disable browser Autocomplete on web form field / input tag?
Okay by now I found the answer myself. It seems easier when you talk about it, does it?
So the problem was, that we used a javascript function to submit our login form site. But that's not how you should do it (say's microsoft). I heard a techcast some minutes ago about the internet explorer relying on suspicious buttons for implemented browser functionality.
Having heard that the answer was kind of clear in my head. I head to submit over a button. Since we (HAVE TO!) use Javascript to submit, cause the button is only a styled div, I had to call a button click to show IE that we do a 'official' postback.
That's the code:
function submitLoginForm()
{
var hiddenSubmitBtn = document.getElementById("hiddenSubmitButton");
if(hiddenSubmitBtn.click) {
hiddenSubmitBtn.click();
} else {
document.loginform.submit();
}
return false;
}
It now works fine.

ADF - Customize a <af:commandButton> width the property styleClass

I all, I'm new to the ADF language and after a long search and failed tries, I have to ask how can I change a button layout - background, border, ... - using the CSS and the property "styleClass" of the ADF?
In my .jspx I have something like:
<af:commandButton action="#{backing_test.echoAction}" id="echo1" text="Save 1" styleClass="commandButton.buttonSaveTest" />
The thing is, after opening firebug, I found out that instead of a regular button, I have an image!
Thanks for you help!
You can't rely on what generated HTML you'll get for a specific component in ADF. The best way to get your own look and feel is to implement your own 'skin', which extends one of those already provided by ADF (eg, 'blafplus', or 'fusion', the new default). You then use the CSS selectors for the component you want, eg
af|inputText::content {
background-color: red;
}
Check out the following link to learn about skinning
http://download.oracle.com/docs/cd/E17904_01/web.1111/b31973/af_skin.htm#BAJFEFCJ
The hosted demo is an excellent way of finding out how to skin specific components. Eg, for your command button, check out:
http://jdevadf.oracle.com/adf-richclient-demo/faces/components/skinningKeys/commandButton.jspx

Categories