Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I started creating an automation framework for my current company. now I’m having a problem with a form that has a JS modal appearing top part of the form attaches to it. that JS form comes every time if I change the default value of the form (Changes Detected: save button, dismissed button). the issue is there is a drop-down box and the default value is set to empty. after I change that to a value (eg: house) that JS modal comes that I have made a change to the form and put the value of the drop-down box to that default empty value. this happens in the run time. if I put a thread.sleep for 3 seconds that solves the issue. but I need a more reliable solution. are there any other options that I can use for this issue?
All I can think of now is to call that first function, Wait for success
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.javaScriptThrowsNoExceptions("putValue()"));
May be a little bit
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
enter image description here
Is it possible to put a button in the table like the attached image?
NatTable is a custom painted table control. Putting real buttons in the table is possible, but actually does not really make sense and could even lead to resource issues in larger tables.
You can actually render anything if you have a corresponding painter. And for a button you of course also need the action binding. NatTable has the ButtonCellPainter to render a cell as a button. But actually the implementation to mimik the button press is a bit outdated IMHO. The corresponding example should give you an idea what you can do and how to do it.
https://git.eclipse.org/c/nattable/org.eclipse.nebula.widgets.nattable.git/tree/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Rendering_cells_as_a_link_and_button.java
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I want to use a JSlider to display my data, and as such I don't want users to be able to move them as then it would no longer display the correct value. At the moment I'm disabling the JSlider so the user can't move the slider, but doing that makes the visibility of the slider really poor.
I would recommend against showing an enabled, but inspirational slider, as it is against typical UI conventions and will likely confuse the users.
Nonetheless, if you really want to do it: The default JSlider is either enabled or not, so you cannot do what you want directly. A workaround would be to have it enabled and add an ActionListener to it. This would be called once the user changes the value. In this ActionListener, you could just reset the value of the slider to its original value, so the slider would snap back. Again, this is very atypical behaviour of UI elements and might confuse users.
In the end, I would suggest coming up with your own component that displays a bar or other slider-like element to visualize your values, but which do not accept any user input.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to click on the button:
<input type="submit" value="Stock!" class="button" tabindex="5" />
Here is my code:
WebElement stock = driver.findElement(By.xpath("//*[#id=\"stock\"]/table/tbody/tr[4]/td/input[5]"));
stock.click();
The program runs without throwing any errors, but the button is not being clicked, and the program is not completing its task.
Try using SendKeys instead of Click. Although it looks strange, it has worked for me in many times.
stock.sendKeys(Keys.ENTER);
Or you can do this very simply as shown below. This will automatically submit the values in the particular form where the element is present. Life made easy.
stock.submit();
Not necessarirly you should use the input (type=submit) for the submit() action. You can use any other element in the html form.
Remove the \" and replace it with '. However, you don't actually have an id attribute so that isn't going to work.
Try:
"//input[#tabindex='5']"
If the tab index is actually set there should only be one that has 5 in there. If there is more than one for some reason you can use the full xpath, but it is really not a good idea to utilize the entire xpath with numbered indexes. If anything changes these might break easily.
You can use cssselector, which looks very clean to read.
WebElement stock = driver.findElement(By.CssSelector("input[value = 'Stock!']")).Click();
Try
driver.findElement(By.className("button")).click();
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am developing a web-based POS,
I have a grid of items which can be purchased.
I want to display the name of the chosen Items
in a text area, as they are being selected.
How can I do that? Java Label? HTML Text Area?
I am a bit lost.
Thank You.
Take a look at this tutorial on Oracle's site. Intially you can set the text value in the constructor but as you add items to your transaction, you can use the append() method to add more lines to the textarea.
You could use a JList which will allow you to add items to a list. It will also allow you to customise the way that the content is rendered as well.
Take a look at How to use Lists
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have an application where I implemented an onKeyPressed event listener for a text field.
In this listener I do a search for results like the input inmy database.
Is there a way that I can show an autocomplete list for the text box displaying the results of the database search?
If you are using swing you can attempt to link the textbox with a list and then you can achive autocomplete functionality using the swing autocomplete package.
Also see this question. Or this one.