How to Load balance Tunnel through Code?
Hi Noah,
To load balance the Tunnel, here’s the pre-requisite to download: https://mvnrepository.com/artifact/com.github.lambdatest/lambdatest-tunnel-binary/1.0.7
Once downloaded, the above dependency needs to be added in the POM.xml file of the project, as shown below:
Tunnel t;
Tunnel t2;
t = new Tunnel();
t2 = new Tunnel();
HashMap<String, String> options = new HashMap<String, String>();
options.put("user", username);
options.put("key", access_key);
options.put("tunnelName", "sample");
options.put("load-balanced", "true");
//start tunnel 1
t.start(options);
HashMap<String, String> options2 = new HashMap<String, String>();
options2.put("user", username);
options2.put("key", access_key);
options2.put("tunnelName", "sample");
options2.put("load-balanced", "true");
//start tunnel 2
t2.start(options2);
Add below capability in your Selenium code:
capabilities.setCapability("tunnelName", "sample");