How to Balance Load in a Tunnel Using Code?
Hi Ian,
Here is how you can Balance Load in a Tunnel using Code:
- Pre-requisite :https://mvnrepository.com/artifact/com.github.lambdatest/lambdatest-tunnel-binary/1.0.7
The above dependency needs to be added to the POM.xml file of the project.
- Use this code snippet you need to add:
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 the below capability in your selenium code.
capabilities.setCapability("tunnelName", "sample");