I want to develop an automation application that works with VPN. For this I have Openvpn config files. However, I don't know how to connect. A solution is mentioned in this link but it didn't work for me. Where and how do I type my vpn user and password? I could not get any results in my research on this.
The application I want to do will work briefly as follows. For example, I will have 50 vpn and my program will connect to the target site by connecting with each vpn respectively. However, as I said, I do not know how to set up an openvpn connection with java. Can you help me with this? Below are the codes I wrote for what I want to do. For example, I wanted to connect to google through italy vpn location.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec("C:\\Program Files\\OpenVPN\\bin\\openvpn C:\\Users\\DATABASE\\OpenVPN\\config\\italy\\italy.ovpn");
} catch (IOException e) {
e.printStackTrace();
}
System.setProperty("webdriver.gecko.driver", "C:\\geckodriver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
try {
driver.get("https://www.google.com/");
} finally {
driver.quit();
}
}
}