I have a search bar that when the search button is hit it will call a web service. The results of the web service can be quite large.
What I want to do is disable the "Search" button until the length of the search phrase is at least 3 characters. This will help in narrowing down the search results.
And yes, I've looked at this post. I can't get it to work for me (3.1.3 SDK).
Is this possible? How would I do this?
You could always add a condition to your searchBarSearchButtonClicked method to check the length of the text in the searchBar. Though that will still show the Search button as enabled, just won't actually do anything even if it's clicked.
Related
I'm trying to use Watir (via Ruby) to jump down the page using the space key, on a page that has infinite scroll. How can I tell if the bottom of the page has been reached?
I found an SO answer with some JavaScript that says when. Could I use that to pop up a dialog (via execute_script) if the bottom has been reached and check for the dialog?
Is there a more straightforward way to do this?
You could just try this:
#browser.scroll.to :bottom
And if that doesn't work:
#browser.driver.executeScript("if((window.innerHeight+window.scrollY)>=document.body.offsetHeight){return true;}")
could surely be used to scroll until it returns true.
Today I got this from an interviewer. I am not sure if anyone cell tell me what should be the right way. Thanks
Below is the question
Consider www.google.com's search box and the Google Search button.
Q: How would you test this functionality?
How would you design test automation for 1) above?
When you're testing something, you want to find the points where the function, webpage, application, etc. break. It's unlikely that the interviewer is asking you to test search box portion of the Google homepage itself, as that is fairly simple (it's little more than a text input and a couple submit inputs inside a form), but rather find potential edge cases in the code which takes that input and produces the search results.
So, consider edge cases for a text input and a submit button in a form using a GET action:
What happens if you submit the form with no input?
What happens if you submit the form with too much input? (Both server and browser may impose limits on the URL generated by the GET, and those limits may be different.)
What happens if you include characters which have special meaning in a GET query string such as & and =?
What happens if you circumvent the page entirely, creating a different <form> which submits to the same page as Google's search box? What if you do this with some input values missing?
Background:
In my program, I have a list of commands that I am sending to a robot. Each command is numbered, and I display them in a list box. When my program finishes running each command, I want it to highlight the next line in the list box. Changing the SelectedIndex seems to give me what I want. However, I do not want the User to be able to change the SelectedIndex through mouse click.
What I have tried so far:
Disabling the list box doesn't work because it disables scrolling
WPF: Disable ListBox, but enable scrolling The solution here seems kind of a bit of a hack, and does not quite give me what I am looking for.
ListView - select index only programmatically Intended for C#, not very familiar with C#, so I'm not exactly sure if this solution will work if I try translating it over to vb.net. If this solution is indeed correct, could I get some guidance on how to translate this to vb.net?
I am kind of stuck at this point, it kind of seems like I should be looking for a better solution to this problem. What do you guys recommend? should I continue trying to look for a way to disable the user from changing selected index with mouse click or should I go a completely different route?
We are seeing odd behavior with JSF inputs that we dont see on regular html input fields.
The field is a search box, and users will commonly swipe the mouse across the field to highlight all existing text, and start overtyping.
You can try this on Google to see what i mean (type a search, leave the field, now clickin on the right side of your entry drag the mouse left - voila, all text is highlighted.)
If we try this exact same process in our JSF app, the cursor just jumps to index 0, and no text is highlighted. Users must repeat the stpe without leaving the field for it to actually highlight the text.
So my question is a) why the difference b) how to work around it
JSF 2.0 (MOjarra)
<h:inputText
class="requiredFields"
id="Search_String"
value="#{searchManager.searchString}"
maxlength="#{searchManager.searchTypeMaxLength()}" />
Turns out this was the result of a hacky implementation of some jQuery validation. Once the faulty library was removed the text box behaves like a text box should!
I am making a webpage that has different areas that can be clicked on to change the contents.
I want to set it up so that when you click on an area, an openWYSIWYG editor appears in the middle of the screen with the rest of the page greyed out.
I have achieved this except for the positioning of the editor. When you click on a section I have a div with 50% opacity cover the page and a textarea appear in the middle. But when I try to attach the editor to the textarea, it loses it's position and falls behind the div not in front of it like the textarea is.
Can anyone suggest a way of centring the openWYSIWYG editor?
You're looking for Modal positioning. Here's one solution:
http://jqueryui.com/demos/dialog/#modal-form
Basically, apply the Jquery Dialog to the div that holds your WYSIWYG. Don't forget a submit button.
Just a quick heads up--I went through quite a bit of headache dealing with WYSIWYG editors for client-facing sites a few months back. It seems that clicking the "paste from WORD" button was a very difficult task to figure out. Word-pasted code can wreak havoc on websites, overrunning text fields in the database. I gave it a try on their demo (which also doesn't support webkit based browsers) and the result wasn't pretty. The only two options I found to solve this were to sanitize code on the back end, or to use CKEditor. I chose the latter because it was so easy. Take a look at CK, it's a great piece of free code.