View Selenium Tests Running in VNC Viewer

Tutorial 34​​ ​​ View Selenium Tests Running in VNC Viewer

Let us now see how to​​ see our tests running in vnc client viewer.

First of all install VCN viewer client from the below official page (simple straightforward installation)

https://www.realvnc.com/en/connect/download/viewer/​​ 

Start docker engine by double clicking docker desktop icon

Wait for the docker engine to start.

Currently we don’t have any images and containers running

Go to hub.docker.com and search for selenium/standalone.

Click the below image

Copy the below pull command

Paste it in terminal​​ and append​​ :latest​​ at the end.

Execute below command

We now have the image

Next we will create container. To do that, go to​​ https://github.com/SeleniumHQ/docker-selenium​​ and scroll down a bit, you would see ‘Debugging’ section

Copy the below command​​ 


Paste it in notepad. Retain only the below portion​​ and append​​ :latest​​ at the end

Copy the above command, paste an execute

Notice that the container is running at port 5900

Let us now open vnc viewer

Using vnc client viewer, we will connect to docker container.

Execute ipconfig command to find ip address of your m/c


In the vnc viewer address bar, enter​​ <ip ad>:5900

Hit Enter

Click Continue

Enter password as​​ secret​​ (mentioned in official documentation)

Click Ok

You would be connected to container, see below. You can now see your tests running on the docker container

Let us execute the below test

Notice below that the test executes in VNC viewer​​ 

So this is how you can view the tests running on vnc client viewer!

Similarly, you can see the tests running on firefox and edge browsers by creating the respective containers using the below commands

Code snippet​​ 

package​​ sel4scripts;

 

import​​ java.net.MalformedURLException;

import​​ java.net.URL;

import​​ org.openqa.selenium.By;

import​​ org.openqa.selenium.WebDriver;

import​​ org.openqa.selenium.chrome.ChromeOptions;

import​​ org.openqa.selenium.remote.RemoteWebDriver;

 

public​​ class​​ GridStandaloneMode {

 

public​​ static​​ void​​ main(String[]​​ args)​​ throws​​ MalformedURLException, InterruptedException {

 

 ChromeOptions​​ opt​​ =​​ new​​ ChromeOptions();

//FirefoxOptions opt = new FirefoxOptions();

//WebDriver driver = new RemoteWebDriver(new URL("https://192.168.33.1:4444"),opt);

 WebDriver​​ driver​​ =​​ new​​ RemoteWebDriver(new​​ URL("http://localhost:4444"),opt);

driver.get("http://google.com");

driver.findElement(By.name("q")).sendKeys("Learning Standalone grid");

 Thread.sleep(3000);

 System.out.println("Test executed successfully");

 

 }

 

}

 

Thank you for reading!

Share On

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on tumblr
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Lifetime Membership Club

LIFETIME MEMBERSHIP BIG SALE - ALL LIVE COURES JUST - 7000 RS/ 99 USD
Attend All Live courses in just 7000 rs / $99 - offer ends 1st Nov 2024