If site is only accessible from VPN then needs to connection
There are two ways of automating such scenarios :
b. Right click on Plugin >> manage extension
c. On redirection copy the URL
             
 
 
 
 
  
  
 
   
  
  
      
    
      
  
 
 
There are two ways of automating such scenarios :
- ADDING CHROME EXTENSION AT RUN TIME USING SELENIUM :
 
b. Right click on Plugin >> manage extension
c. On redirection copy the URL
                d. First, need to download the .crx file of the extension. 
                e.  Go to  https://crxextractor.com/ then enter the link of the chrome extension in the download box then click on Get .CRX button. 
               g.    GIVE THE PATH OF THE CRX FILE TO THE ADDEXTENSIONS() METHOD
package Test;
import java.io.File;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;
public class AddChromeExtension {
 public static void main(String[] args) {
  System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver.exe");
  ChromeOptions option = new ChromeOptions();
  option.addExtensions(new File("C:\\Users\\sac\\Downloads\\extension_3_5_0_0.crx"));
  WebDriver  driver  = new ChromeDriver(option);
   driver.get("https://www.inviul.com/");
      driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
      driver.manage().window().maximize();
      System.out.println(driver.getTitle());
 }
}
    f. When run Selenium script , Browsers have extension :
2.    Create new profile in firefox browser :
            a.   Open firefox browser and add  "about:profiles" in url 
            b.  Create a new profile   
                    c. 
- If Firefox is open, close Firefox: Click the Firefox menu 
 and select . - Press 
 +R on the keyboard. A Run dialog will open. - In the Run dialog box, type in:
firefox.exe -P
You can use-P,-por-ProfileManager(any of them should work). - Click . The Firefox Profile Manager (Choose User Profile) window should open.
 
// import the package
import java.io.File;
      import java.util.concurrent.TimeUnit;
      import org.openqa.selenium.WebDriver;
      import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
public class FirefoxProfile {
  public static void main(String[] args) {
 ProfilesIni profile = new ProfilesIni();
 FirefoxProfile myprofile = profile.getProfile("xyzProfile");
// Initialize Firefox driver
 WebDriver driver = new FirefoxDriver(myprofile);
//Maximize browser window
 driver.manage().window().maximize();
//Go to URL which you want to navigate
 driver.get("http://www.google.com");
//Set  timeout  for 5 seconds so that the page may load properly within that time
 driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
//close firefox browser
 driver.close();
}
}



No comments:
Post a Comment