How can I access the application using selenium webdriver that works through VPN?

前端 未结 1 911
故里飘歌
故里飘歌 2020-12-19 16:58

For example, I have an application \"www.test.com\", to access this site I have installed browsec VPN in firefox then I can see the application content - accessing the site

相关标签:
1条回答
  • 2020-12-19 17:52

    You have to load the extension using firefox profiles in WebDriver. The path to extension file is usually here C:\Users\administrator\AppData\Roaming\Mozilla\Firefox\Profiles\ew0u966b.default-1507268891903\extensions

    WebDriver driver = null;
    
    FirefoxProfile firefoxProfile = new FirefoxProfile();
    File addonpath = new File("path of addon/extension (.xpi file)");
    firefoxProfile.addExtension(addonpath);
    
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability(FirefoxDriver.PROFILE, profile);
    
    driver = new FirefoxDriver(capabilities);
    
    driver.get("http://www.helloselenium.com");
    
    driver.quit();
    

    http://www.helloselenium.com/2014/09/how-to-add-addon-to-firefox-instance-of.html

    For chrome see below link

    http://www.abodeqa.com/2013/08/24/adding-add-on-in-firefox-and-chrome-using-webdriver/

    To start the extension, the following should work.

    Every extension will have a unique id which can be used to open the extension in the browser. When you install browsec plugin, you will get a url like this indicating the id. moz-extension://f1b30486-cd88-4319-bbb5-d5e387103414/congratulations.html I am not sure about how to obtain this id in any other way or whether it will be same for different installations. I have asked a question in SO for the same - Get add-on id of extensions in Firefox

    Replacing congratulations.html with popup.html should open the extension in the browser. You can then treat this like a normal webpage and automate it using selenium WebDriver. After you start the extension in this way, you can then load the url of the application under test and continue.

    0 讨论(0)
提交回复
热议问题