How to count number of images available on a web page then download them using selenium webdriver?

The simplest way to gather the images from a website is to find them by tagName.
First we create a WebElement list with the elements which tagName is ”img”.
Then we check the elements to be sure that they are displayed.
If they are displayed then we get their names and sources.
To download them we use the “org.apache.commons.io.FileUtils.copyURLToFile” function.
It is very simple, we just need to add the URL and the file path to it.
In the end we write out the number of displayed elements.

Here is to full code:

Screen recording – screencast – part III

In my previous posts I have described my favorite solutions for screen recording(Screen recording – screencast – part I and Screen recording – screencast – part II). Applications are free, just have to create an account. They have some limitations, but for the basic screen recording and image editing, they will work perfectly.
This time I will describe some paid/professional and easy-to-use programs. When we are talking about professional image/video editing, we have to say that there are many applications for this purpose. Most of them are very expensive, but they give lot of tools for image/video editing.

Graphwalker – Guards and actions

In our previous articles we have already discussed about the finite state machines and about how we can take advantage from this utility of the Graphwalker API. It is based on nodes and vertices which are connected to each other to become a graph and forming a test case to make your job easier and clear.
Moreover Graphwalker provides additional possibilities to make the job be in a batter quality. The edges could be extended by expressions and these can modify the further way of test run. Excluding the label the edge can contain two other elements. The first one called guard and another one is action. These have a unique order like this: Label [Guard] / Action1; Action2;

Graphwalker Path generators and Stop conditions

In this post we will try to give some ideas how to use the Graphwalker Path generators combined with Stop conditions. We recommend you to read our latest post about the Graphwalker API , however here is the snippet of code from last post:

ModelHandler modelHandler = new ModelHandler();
File loginModelFile = new File("'your location for the graphml file'/LoginModel.graphml");
Test testModel = new Test(loginModelFile, true, new A_StarPathGenerator(new EdgeCoverage(1.0)), false);
modelHandler.add("Test", testModel);
modelHandler.execute("Test");
Assert.assertTrue(modelHandler.isAllModelsDone());
String actualResult = modelHandler.getStatistics();
System.out.println(actualResult);
testModel.getDriver().quit();

Changing user agent with webdriver

Not so long ago we had to implement a test case where the user goes to a page with an “unknown” browser.
I had to spend some time to find out the proper configuration and made a small post about it to avoid doing it again.

All you have to do is to change the default user-agent. You can do this by instantiating a new ChromeOptions object and add you user agent as an argument.

Very Short example:

public class SampleTestClass  {

@Test
public void sampleTest(){

ChromeOptions chrome = new ChromeOptions();
chrome.addArguments("user-agent=YOUR_USER_AGENT");

WebDriver driver = new ChromeDriver(chrome);

// you can check your user-agent on this site
driver.get("https://www.whatismybrowser.com/");

driver.quit();
}

}

Advanced Google Drive features for max productivity

Google Drive is a file storage and synchronization service provided by Google. Most people think that Google Drive is just a rebranding of Google Docs. However, it is much more than that. Besides the Google Docs office suite, it offers cloud storage, file sharing and collaborative editing.

With the integration of web based apps into Google Drive many features that it lacked are now only one click away. Need to send a fax? Use Hellofax. Need to eSign a document? DocuSign comes to the rescue. Whatever your needs, there is probably an app for it.

Some thoughts on Sauce

We’re started using this service a long time ago, and I can say they improved a lot in the recent years.
It became a reliable cloud system for running automated tests and for manual testing with a wast amount of virtual machine/browser combinations and what I love about them that almost everything is documented.

sc1

VisGrid – a GUI for Selenium Grid

VisGrid is a very useful GUI tool to start/stop the Selenium hub and to add/remove nodes to it.
First step to download the program from http://www.codoid.com/products/view/2/30 and to extract wherever you want.
We can start to program with the ‘VisGrid.jar’ file.

visgrid1

Screen recording – screencast – part II

In my previous post I have started introducing Jing. This time I will continue with Jing options and after that I will describe Box Simple Share.

Jing

After the record window was selected, there will be displayed the following options: Capture Screenshot, Capture Video, Redo selection and Cancel.

Checking the page links

Nowadays, by the technical advancement, people are meeting more and more issues, which are waiting to be solved. It’s clear, that everyone wants to find the simplest way, but sometimes the simplest is the worst way.
The complexity of the different tasks resulted on the end that there is no man/woman in the world who don’t make any mistakes. There are always unpredictable things, missing settings, elements and that is because we need to test the websites as effective as possible. But how to check all the page links on the page at once? (Checking all the links can mean finding viruses, too.)