Selenium Grid on LOCAL SYSTEM

122 views
Skip to first unread message

Virender Chauhan

unread,
Jan 7, 2021, 8:24:20 AM1/7/21
to seleniu...@googlegroups.com
Hi Guys,

1) Can we run Selenium Grid using STATIC EventFiringWebDriver

2) Can we run Selenium Grid on LOCAL SYSTEM (No other machine involved) just to verify the  Selenium Grid is implemented correctly? If yes, Can we run 3 TCs in 3 different browsers (Chrome,  FF,  EDGE) parallely ?
 
Webdriver at my end is defined as:
protected static EventFiringWebDriver Driver = null;   

Please help.

Thanks and Regards,
--------------------------------------------------------
Virender Kumar
Cigniti Technologies Ltd

⇜Krishnan Mahadevan⇝

unread,
Jan 8, 2021, 12:35:47 AM1/8/21
to Selenium Users
Not sure what exactly are you asking.

1) Can we run Selenium Grid using STATIC EventFiringWebDriver 

The Grid is a standalone JVM (which of course you could spin off via your code too), but EventFiringWebDriver has got nothing to do with it. EventFiringWebDriver is just a client to the Grid just as RemoteWebDriver (just that it wraps event eavesdropping capabilities into it)

2) Can we run Selenium Grid on LOCAL SYSTEM (No other machine involved) just to verify the  Selenium Grid is implemented correctly? If yes, Can we run 3 TCs in 3 different browsers (Chrome,  FF,  EDGE) parallely ?

Ofcourse you can. Download the selenium grid standalone jar. Open two terminals. In one terminal start the hub and in the other start the node and you should be good to go. 
Parallelism is NOT an attribute of the selenium grid. Its an attribute of your test runner. So the grid doesn't care whether you are running tests in sequence or in parallel. If there are test slots available it will run them on those free slots.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CALQFjG9uO4oeXfkOMk4tcjL500CTq2_xjWa3N8%2BmiSo4-dJL4Q%40mail.gmail.com.

Virender Chauhan

unread,
Jan 8, 2021, 2:12:59 AM1/8/21
to seleniu...@googlegroups.com
Hi Krishnan

Thanks for the detailed explanation. Could you please help me with any helping doc / video as reference to implement a grid in the local box?
 

Not sure what exactly are you asking. 

Reasoning for Ask1: In one of the video (executeautomation.com), it was mentioned that If the WebDriver is Static then parallel execution can not be performed
And since the  EventFiringWebDriver  is static at my end (in the framework) and I am supposed to implement Selenium Grid in the same framework. Moreover I do not have any other machine and was planning to implement it on local machine, hence asked.  

Reasoning for Ask2: Also as per the website like  browserstack.com
Selenium Grid is a smart proxy server that makes it easy to run tests in parallel on multiple machines.  



Thanks and Regards,
--------------------------------------------------------
Virender Kumar
Cigniti Technologies Ltd

⇜Krishnan Mahadevan⇝

unread,
Jan 8, 2021, 3:54:09 AM1/8/21
to Selenium Users
Am not going to comment on the documentation or material that you have linked to.

The notion of something being static and not supporting parallelism is a programming construct and has nothing to do with Selenium or Grid.

In general, static data ends up being visible across multiple threads and they are not bound to instances, but bound to classes.
So if your WebDriver reference is static (doesn't need to be EventFiringWebDriver also) then you have already shot yourself in the foot from being able to support parallel execution.

Am going to assume that you are working with Java and conveniently also going to assume that you are working with TestNG (since I don't see any reference to any of that in your post).

Take a look at this blog post, that should show you what you need to be doing in order to enable parallel execution:


You could alternatively even consider using a library such as auto spawn that I built (https://github.com/RationaleEmotions/autospawn) which abstracts out the entire notion of browser management from you and lets you work with a WebDriver instance in a thread safe fashion.

You can refer to one of the below links to learn more about the Selenium Grid.

My end to end full fledged documentation that talks about almost all aspects of Grid3 - https://rationaleemotions.github.io/gridopadesham/




Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/

Virender Chauhan

unread,
Jan 8, 2021, 11:48:54 AM1/8/21
to seleniu...@googlegroups.com
Thanks  Krishnan for help and sharing the blog. I will try to implement this. 


Thanks and Regards,
--------------------------------------------------------
Virender Kumar
Cigniti Technologies Ltd

Virender Chauhan

unread,
Jan 10, 2021, 9:10:44 AM1/10/21
to seleniu...@googlegroups.com

Hi Guys,

Am facing some issues while performing execution (Selenium Java) as the browser is not getting launched when trying using RemoteWebDriver whereas all is working fine on local browsers. Please help.

I have set up Selenium Grid on my local box (node , hub are at the same machine).   

Versions:
Standalone Jar (Grid)  : 3.141.59
-------------------------------------------------------------------------------------------------------------
RemoteWebDriver  Code:  
String hubURL = "http://localhost:4445/wd/hub";   // Grid is up and running 
 ChromeOptions options = new ChromeOptions();
 options.setCapability(CapabilityType.PLATFORM_NAME, Platform.WIN10);
 options.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);
 options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
 this.WebDriver = new RemoteWebDriver(new URL(hubURL), options);
-------------------------------------------------------------------------------------------------------------

Selenium Grid is up and running  - >
Selenium Grid: 
image.png

NODE connected to HUB: 

image.png



Thanks and Regards,
--------------------------------------------------------
Virender Kumar
Cigniti Technologies Ltd

⇜Krishnan Mahadevan⇝

unread,
Jan 11, 2021, 3:22:55 AM1/11/21
to Selenium Users
What is the error you see when trying to launch the browser against the grid ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/

Virender Chauhan

unread,
Jan 11, 2021, 9:02:37 AM1/11/21
to seleniu...@googlegroups.com
Hi Krishnan

Am getting error as below:  

org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'LP000557', ip: '172.19.194.28', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261' Driver info: driver.version: unknown Command duration or timeout: 97 milliseconds 
 
org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'LP000557', ip: '172.19.194.28', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261'
Driver info: driver.version: unknown
Command duration or timeout: 97 milliseconds
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
	at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
	at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
	at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:122)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:125)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:143)
	at com.automation.accelerators.TestEngineWeb.setWebDriverForLocal(TestEngineWeb.java:215)
	at com.automation.accelerators.TestEngineWeb.beforeClass(TestEngineWeb.java:115)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'LP000557', ip: '172.19.194.28', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261'
Driver info: driver.version: unknown
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'LP000557', ip: '172.19.194.28', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261'
Driver info: driver.version: unknown

Thanks and Regards,
--------------------------------------------------------
Virender Kumar
Cigniti Technologies Ltd

⇜Krishnan Mahadevan⇝

unread,
Jan 11, 2021, 9:11:11 AM1/11/21
to Selenium Users
Wow that was a pretty bright red colour :)

Have you made sure that chromedriver.exe is either available in the PATH or that the Node was started by passing in the location of the web driver binary via the JVM arguments ? The error seems to suggest that the node had problems in spinning off the chromedriver.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/

Virender Chauhan

unread,
Jan 11, 2021, 9:32:14 AM1/11/21
to seleniu...@googlegroups.com
Hi Krishnan ,

Yes, it is being set using System.setProperty [Line no 200 as shown below].  Apart from this, do I need to do anything else  ?
Please accept my apologies if am not getting your view as I am new to Selenium and Java even.

image.png

Thanks and Regards,
--------------------------------------------------------
Virender Kumar
Cigniti Technologies Ltd

Virender Chauhan

unread,
Jan 11, 2021, 9:52:51 AM1/11/21
to seleniu...@googlegroups.com
Hi Krishnan ,


   > java -Dwebdriver.chrome.driver=/path/to/chromedriver.exe -jar /Users/admin/selenium-server-standalone-3.14.0.jar -role node -hub http://<IP_GRID_HUB>:4444/grid/register     
 
But did not get any luck, getting issues as listed below: 

  <<< FAILURE!  
org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'LP000557', ip: '172.19.194.28', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.1'
Driver info: driver.version: unknown
remote stacktrace: Backtrace:
Ordinal0 [0x00FDC013+3194899]
Ordinal0 [0x00EC6021+2056225]
Ordinal0 [0x00D5F608+587272]
Ordinal0 [0x00D0147D+201853]
Ordinal0 [0x00D00E98+200344]
Ordinal0 [0x00D01DA7+204199]
Ordinal0 [0x00D01D0D+204045]
Ordinal0 [0x00CFFC1B+195611]
Ordinal0 [0x00CE3B7F+80767]
Ordinal0 [0x00CE4B4E+84814]
Ordinal0 [0x00CE4AD9+84697]
Ordinal0 [0x00EDCE64+2149988]
GetHandleVerifier [0x0114BE95+1400773]
GetHandleVerifier [0x0114BB61+1399953]
GetHandleVerifier [0x011531FA+1430314]
GetHandleVerifier [0x0114C69F+1402831]
Ordinal0 [0x00ED3D61+2112865]
Ordinal0 [0x00EDE5CB+2155979]
Ordinal0 [0x00EDE6F5+2156277]
Ordinal0 [0x00EEF26E+2224750]
BaseThreadInitThunk [0x75B96359+25]
RtlGetAppContainerNamedObjectPath [0x77877C24+228]
RtlGetAppContainerNamedObjectPath [0x77877BF4+180]

Any Clue????


Thanks and Regards,
--------------------------------------------------------
Virender Kumar
Cigniti Technologies Ltd

Virender Chauhan

unread,
Jan 27, 2021, 4:01:28 AM1/27/21
to seleniu...@googlegroups.com
Hi All,
Single Node : Am able to trigger test case (having 5 Steps) on a single node using Selenium GRID on a LOCAL machine.

String nodeURL = "http://localhost:4445/wd/hub";  
this.WebDriver = new RemoteWebDriver(new URL(nodeURL), capabilities);
this.WebDriver.get("https://www.google.com/");

Two Nodes : It is triggering two nodes , performing TC on node1 successfully.  
And opens the URL on NODE2 but NOT performing the testcase steps on NODE2  , when trying with below Code:

String nodeURL = "http://localhost:4445/wd/hub";
String nodeURL1 = "http://localhost:4446/wd/hub";

this.WebDriver = new RemoteWebDriver(new URL(nodeURL), capabilities);
this.WebDriver.get("https://www.google.com/");

this.WebDriver1 = new RemoteWebDriver(new URL(nodeURL), capabilities);
this.WebDriver1.get("https://www.google.com/");


image.png

Any help?

Thanks and Regards,
--------------------------------------------------------
Virender Kumar
Cigniti Technologies Ltd

⇜Krishnan Mahadevan⇝

unread,
Jan 27, 2021, 4:10:44 AM1/27/21
to Selenium Users
Why are you having different URLs for different tests (when working with 2 nodes) ?
You should always be pointing to the hub and let the hub internally distribute the traffic across the nodes registered.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/

Reply all
Reply to author
Forward
0 new messages