Replace implicit wait with explicit wait (selenium webdriver & java)

Implicit wait is defined once right after the driver initialization for the driver life time, and it sets the maximum amount of time for the driver to look foe WebElement. Explicit wait is used to wait up to the given amount of time for the WebElement to be in cretin condition, and need to be … Read more

Fancybox links don’t show in lightbox – what am i missing?

This href=”http://placehold.it/350×125″ doesn’t say to fancybox that you are opening an image so you either : 1). add the fancybox.image special class to your link like <a class=”cta-nav-hover fancybox fancybox.image” href=”http://placehold.it/350×125″ title=”Bio”><span></span></a> 2). add the (HTML5) data-fancybox-type attribute to your link like <a data-fancybox-type=”image” href=”http://placehold.it/350×125″ title=”Bio” class=”cta-nav-hover fancybox”><span></span></a> 3). add the type option to your … Read more

Why are my fields initialized to null or to the default value of zero when I’ve declared and initialized them in my class’ constructor?

Entities (packages, types, methods, variables, etc.) defined in a Java program have names. These are used to refer to those entities in other parts of a program. The Java language defines a scope for each name The scope of a declaration is the region of the program within which the entity declared by the declaration … Read more

JPanel in puzzle game not updating

Rather than relying on precut image files, here’s an example of slicing an existing image and shuffling the resulting pieces. It combines the helpful (+1) suggestions of both @Frederick and @akf. import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.imageio.ImageIO; import javax.swing.ImageIcon; … Read more

How can I select a html element no matter what frame it is in in selenium?

No, it is not possible to interact with any WebElement within an <iframe> through Selenium without switching to the respective iframe. Reason : When a page is loaded, Selenium‘s focus by default remains on the Top Window. The Top Window contains the other <iframes> and the framesets. So when we need to interact with a … Read more

Passing current Date

The example below creates MAX ornaments for your tree. It uses a ComponentListener to relocate any outlying ornaments. package merrychristmas; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.util.LinkedList; import java.util.Queue; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public … Read more

How perform validation and display error message in same form in JSP?

Easiest would be to have placeholders for the validation error messages in your JSP. The JSP /WEB-INF/foo.jsp: <form action=”${pageContext.request.contextPath}/foo” method=”post”> <label for=”foo”>Foo</label> <input id=”foo” name=”foo” value=”${fn:escapeXml(param.foo)}”> <span class=”error”>${messages.foo}</span> <br /> <label for=”bar”>Bar</label> <input id=”bar” name=”bar” value=”${fn:escapeXml(param.bar)}”> <span class=”error”>${messages.bar}</span> <br /> … <input type=”submit”> <span class=”success”>${messages.success}</span> </form> In the servlet where you submit the form to, … Read more