我正在使用以下代码来获得Chrome扩展程序(Browsec VPN)并打开和自动化必须在VPN上打开的特定站点 - 我的代码可以启动带有扩展程序的浏览器,但扩展程序始终处于禁用模式 - 我需要将其设置为启用模式。请帮忙!谢谢
package AutomationTesting;
import java.io.File;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class Test1 {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
//WebDriver driver = null;
String URL = "https://google.com/";
System.setProperty("webdriver.chrome.driver", "C:\\New_Selenium\\chromedriver_win32\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("C:\\New_Selenium\\Browsec-VPN-Free-and-Unlimited-VPN_v3.19.4.crx"));
//DesiredCapabilities capabilities = new DesiredCapabilities();
//capabilities.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(options);
driver.get(URL);
driver.manage().window().maximize();
Thread.sleep(2000);
driver.quit();
}
}