I need to create a wizard in which the first page allows the user to select the type of the element to create, and the following pages create and set-up the selected type. In several aspects it is similar to the standard New Wizard (File->new...) but I need more control on what's happening.
How can I do that? Does there is any tutorial about that?
I see three options on how to achieve this:
Override the getNextPage(...) function of Wizard
or
Add the remaining pages to the wizard just-in-time. That is, after the user has selected what type of element to create.
or
Make the remaining wizard pages dynamic in such a way that they have different contents depending on what kind of element is being created
I recommend the first option.
Related
Right now we have an element on the page that is not allowing users to tab out of it. The element was created in Java as a GWT component, I don't really know too much about GWT so I can't really describe it further.
Anyways, I know where I need to tell the component to tab to the next element in the tab order, but I don't know what commands to use to do so. Is there a way to retrieve the tab order of HTML elements in Java? If there is, I can just pick the next element in the list and set it to be focussed.
Using GWT com.google.gwt.dom.client.Element you can access and set the tabIndex value of any GWT component (i.e. html element). If you're using a Widget class you can use myWidget.getElement().getTabIndex() and setTabIndex(1).
In HTML you cannot just pick the next element with the tab out of the box, you can however maintain the tab indexes order in the order you expect.
This is my first Java project and I'm not sure where to look/what to search for for information on this question.
I've built Java code in Eclipse using Selenium WebDriver that opens a product page, adds a product to cart, and completes the checkout process automatically. Is it possible to create a GUI with textbox submissions that would insert variables into my already-created code? For example, I'd like to create a GUI that would update my code with the submitted size rather than having to hard-code '6.5' every time as seen in the code below.
wd.findElement(By.xpath("//div[#class='size-options-buttons']/ul//a[#title='6.5']")).click();
Any information or guidance on what to research would be greatly appreciated!
I wouldn't think you would want/need to create a GUI to do this. You should just create a variable that contains the value you want used in your searches and then you can update that value any time you want in only one place.
String title = "6.5";
wd.findElement(By.xpath("//div[#class='size-options-buttons']/ul//a[#title='" + title + "']")).click();
If you wanted, you could read this and other values from a text file, XML, etc.
This is achievable with Java, but its not a part of Selenium as such. You can explore Java GUI frameworks such as AWT, Swing etc, using which you can create your GUI. You can add a text box and button in your UI. Upon click of the button, you can run your Selenium code, where it can fetch the value you entered in the text box as a variable as pass it on to your script.
It all depends on how far you want to take this. You can create very basic UIs with say JavaScript, VBScript as well. These would give you the basic functionality of a text box and button.
You can use an excel sheet also, where you can set these values and pass it on to your script.
I have a JavaScript code embedded in a Java method to retrieve properties of any element clicked upon in a web page.
That is, I navigate to a specific URL by creating an instance of Selenium WebDriver from my Java application and click on an object in the page that gets loaded. After the single click on the object, a HTML page opens listing the name, type, id, class name etc. associated to that object as a radio button group. I select one option from the list and click on OK. What I wanted to know is, can I push the selected data from the HTML back onto my Java application on the click event on the HTML?
Any help appreciated! Thanks! :)
WebElement interface of selenium Webdriver gives a method
getAttribute which provides value of a given attribute of the desired html element.
I hope this method is what you are looking for.
USAGE:
String field_value;
field_value = driver.findElement(By.xpath("xpath Locator")).getAttribute("attribute name")
The information which you want to get should be in any of the attribute associated to that element.
Similarly if you want all attributes associated with the element in one go you can use something like this :
((JavascriptExecutor)driver).executeScript("return arguments[0].attributes);", element);
The above will give you a comma separated list of all attributes on which you can apply your coding logic to separate them and get the corresponding values using loops.
I was wondering that the textbox itself identifies its type and when clicked inside textbox it gives the suggestion for that. For a instance i am creating a textbox for mobile no and when click inside the textbox it correctly detects it. Can anyone explain me how it was coded. It was browser feature or HTML feature?
Here is the Image explanation
This features of modern browsers is called auto-fill option, where the browser recognizes that you have performed a specific search before and suggests information that you have typed before. For sweepers, auto-fill saves a ton of time. When Roboform doesn't fill out a form for me, I usually only have to double-click in the text field and select the data I want from the drop-down list of options. This is particularly useful for daily sweepstakes that require codes.
HI All,
I am desperately looking for the assistance on adding and removing the fields and rows using JSF. I am using ICE Faces for the rich UI look. The following is my problem:
I have to add one text box and two buttons (+) and (-) in a row.
When user clicks on the + button, one new row should be added with the above components.
When user clicks on the - button, the corresponding row should be removed from the display.
I am able to add the individual components like text box and remove it. But, here my challenging point is to add and remove as a row. How would I remove that specific row (instance) from the UI View Root.
I have tried several times, but till now I could not find a solution. Please suggest me the possible solutions.
Thanks in advance,
Krishna
Rather use a h:dataTable (or the IceFaces equivalent ice:dataTable) which is backed by a List<Data> contining objects which each represents the data of a single row. On Add just add a new Data item to the list. On Remove just remove the selected Data item from the list.
See also:
How to dynamically add new row to table? - detailed answer to similar question
Using Datatables - shows step by step how to use datatables in JSF 1.x.
CRUD datatable using #ViewScoped - simple example of JSF 2.0 CRUD