0

I am trying to use Selenium stanalone 3 beta4.jar + FireFox48 + Geckodriver on a RD machined and below are problem I am observing :

i) I am not able to bypass or Ignore the Certificate Security Error for my application below is the piece of code I am using.

ii) And I want to invoke the custom or default firefox profile on the basis on user input, but this also does not work If i trigger the Automation suite from Jenkins(linux machine) I observed that each time i trigger the suite it creates a New FireFox profile rather than invoking the default or custom value which I am passing from Code. However, If I call the same Test suite from Eclipse which is installed on a Windows machine the firefox profile value gets picked as per code.

Note: I am using Remote Desktop to execute my Test Suite,which means my application will be invoked on a RD and all execution will happned there only calling part I can want to do from Jenkins (Linux machine).

Below is piece of code I am using:

if(browser.contains("FIREFOX") || browser.equalsIgnoreCase("firefox") || browser.contains("mozilla"))
   {
        FirefoxProfile profile = new FirefoxProfile();
        ProfilesIni allProfiles = new ProfilesIni();
        capability = DesiredCapabilities.firefox();
        capability.setCapability("marionette", true);



        /* If Profile value is passed i.e. Selenium_Default profile is not going to be used, user wants to use some custom profile*/                        
        if(!browserProfile.equalsIgnoreCase("SELENIUM_DEFAULT") || !browserProfile.equalsIgnoreCase("default"))
        {                       
            profile = allProfiles.getProfile(browserProfile);
            logger.debug("Profile passed : " + profile);
            capability.setCapability(FirefoxDriver.PROFILE, profile);


        }
        else
        {
                /*Handling case for default profile*/
                profile = allProfiles.getProfile("default");
                logger.debug("Profile passed : " + profile);
                capability.setCapability(FirefoxDriver.PROFILE, profile);

        }
        logger.debug("Profile :" + profile);
        profile.setAcceptUntrustedCertificates(true);
        profile.setAssumeUntrustedCertificateIssuer(false);                 
    }
browserDriver = new RemoteWebDriver(new URL(nodeAddress), capability);
browserDriver.manage().timeouts().pageLoadTimeout(1000, TimeUnit.SECONDS);          
browserDriver.manage().timeouts().implicitlyWait(90, TimeUnit.SECONDS);
browserDriver.manage().window().maximize();
browserDriver.get(applicationUrl);

logger.info("WebDriver successfully defined with Session ID:" +  browserDriver.getSessionId() + ", Page Title:" + browserDriver.getTitle() + " and URL: " + browserDriver.getCurrentUrl());
Louis
  • 146,715
  • 28
  • 274
  • 320

1 Answers1

1

I faced the same problem earlier, in my case I failed to load the url also. According to forum is a bug of firefox and selenium webdriver. Later tried the following steps

  1. Downloaded geckodriver installed in in my machine

  2. Configured the following base environment inside code

    public class BaseConfiguration {

       public void initEnvironment(){
    String marionetteDriverLocation =  "D:\\geckodriver\\wires.exe";
    System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);     
     }
    public WebDriver loadDriver(String url)
    {
    WebDriver driver = new MarionetteDriver();      
    driver.manage().window().maximize();
    driver.get(url);
    return driver;}
    
  • Hi Kumrun, Thanks for replying. I do not want user to send the location of geckodriver as this might differ from machine to machine when i invoke the code, to handle this I am starting the Selenium standalone server with below set of commands on RD before triggering the suite, i think this should also set the property in server : – Anshuman Singh Oct 10 '16 at 11:22
  • Command is: java -Xmx700M -Dwebdriver.ie.driver="IEDriverServer.exe" -Dwebdriver.chrome.driver="chromedriver.exe" -Dwebdriver.gecko.driver="geckodriver.exe" -jar selenium-server-standalone-3.0.0-beta4.jar -port 4444 1>console.log 2>&1 Please let me know if still i need to set the driver location in System.setProperty()? – Anshuman Singh Oct 10 '16 at 11:23