Running Your Automation in Browser Nodes without Selenium Grid

Running Your Automation in Browser Nodes without Selenium Grid

In the previous article I showed you how we can execute scripts in Selenium Grid in Docker. I was thinking how we can run Selenium automation scripts without the Grid, where we can execute the scripts in different browser nodes.

This can be done in the following way.

First pull the Docker container which is selenium/standalone-chrome-debug

docker pull selenium/node-chrome-debug

Next start the selenium/standalone-chrome-debug container

docker run –d –P –link selenium-hub:hub selenium/node-chrome-debug

Do a docker ps command and check the port of the container and login via VNC Viewer.

No alt text provided for this image

Connect via VNC with port number 32769 in this case.

No alt text provided for this image

Now modify the script with the IP address of the Remote Web Driver and execute the script.

	@Test
		
		public void test() throws EngineException, AudioException, EngineStateError, IllegalArgumentException, InterruptedException, IOException
		{
		
			 
			 
			DesiredCapabilities cap = DesiredCapabilities.chrome();
			cap.setPlatform(Platform.LINUX);
			WebDriver driver = new RemoteWebDriver(new URL ("https://127.0.0.1:32770/wd/hub"),cap);
	
		
	    	
	        String baseUrl = "https://demo.guru99.com/V4/";
	      


	        driver.get(baseUrl);
	        
	        driver.findElement(By.name("uid")).sendKeys("mngr206361");
	        driver.findElement(By.name("password")).sendKeys("AdUbupU");
	   
	        driver.findElement(By.name("btnLogin")).click();


	       // System.out.println (driver.findElement(By.xpath("https://tr[@class='heading3']/td")).getText());
	      Assert.assertEquals(driver.findElement(By.xpath("https://tr[@class='heading3']/td")).getText(), "Manger Id : mngr206361");
	        driver.close();
		}

In the VNC Viewer you will see the script getting executed.


Sasidhar Vundela

Lead QA Engineer+ Scrum Master | SDET || EX TCS || EX Infosion || Banking | Retail & Logistics |

2 年

docker run –d –P –link selenium-hub:hub selenium/node-chrome-debug this command is throwing docker: invalid reference format.

回复

要查看或添加评论,请登录

Kushan Shalindra Amarasiri的更多文章

社区洞察

其他会员也浏览了