Skip to main content

You are here

Selenium WebDriver

Add up numbers on a table using Selenium

I made a few assumptions on this one. For example the number of rows. Am sure there is a way to determine the row end. Otherwise watch the console as the code runs. It lists the numbers and adds a sum at the end.

Taking Screen Shot using Selenium WebDriver

The following code takes a screen shot of the website First, the Firefox browser is opened, then the site is loaded. The screen shot is taken and stored in a folder on the C:logicandtricks. Ensure you edit the location for the screen shot file as you see fit on the line:

FileUtils.copyFile(screenshot, new File("c:\\logicandtricks\\screenshot.jpg"));

To run the program you need to have Selenium configured.

Have fun!

How to simulate mouse movement in Selenium WebDriver

This code navigates to a website It then simulates moving the mouse from one menu link to the other. Observe the dropdown menu as focus shifts from one menu option to the other. There is a slight delay between each menu option (curtesy of Thread.sleep).

For some strange reason a previously visited menu link's dropdown remained even after focus shifted. Hoping some gurus can explain that to us in the comments sections. smiley

Premium Drupal Themes by Adaptivethemes