Skip to main content
added more information
Source Link
Floella
  • 319
  • 1
  • 7
  • 14

I actually found out how to do it:

I created a .java file within src/main/java/mycompany and added a method that sets up the property:

package mycompany;

public class Setup {
    public void browserSetup() {
        System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
    }
}

Then, in my test, I imported this as a library:

*** Settings ***
Library  Selenium2Library
Library  mycompany.Setup

And then invoked the method as a new keyword: Browser Setup.

That was it. I ran it and it worked.

EDIT: Just in case anyone is wondering how to reference chromedriver.exe as a relative path within the project, I placed the exe file in my {root_project_directory}\src\test\resources directory, then used it as src\\test\\resources\\chromedriver.exe (notice the \ escaping needed).

I actually found out how to do it:

I created a .java file within src/main/java/mycompany and added a method that sets up the property:

package mycompany;

public class Setup {
    public void browserSetup() {
        System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
    }
}

Then, in my test, I imported this as a library:

*** Settings ***
Library  Selenium2Library
Library  mycompany.Setup

And then invoked the method as a new keyword: Browser Setup.

That was it. I ran it and it worked.

I actually found out how to do it:

I created a .java file within src/main/java/mycompany and added a method that sets up the property:

package mycompany;

public class Setup {
    public void browserSetup() {
        System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
    }
}

Then, in my test, I imported this as a library:

*** Settings ***
Library  Selenium2Library
Library  mycompany.Setup

And then invoked the method as a new keyword: Browser Setup.

That was it. I ran it and it worked.

EDIT: Just in case anyone is wondering how to reference chromedriver.exe as a relative path within the project, I placed the exe file in my {root_project_directory}\src\test\resources directory, then used it as src\\test\\resources\\chromedriver.exe (notice the \ escaping needed).

deleted 6 characters in body
Source Link
Floella
  • 319
  • 1
  • 7
  • 14

I actually found out how to do it:

I created a .java file within src/main/java/mycompany and added a method that sets up the property:

package mycompany;

public class Setup {
    public void browserSetup() {
        System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
    }
}

Then, in my test, I imported this as a library:

*** Settings ***
Library  Selenium2Library
Library  automated_testsmycompany.Setup

And then invoked the method as a new keyword: Browser Setup.

That was it. I ran it and it worked.

I actually found out how to do it:

I created a .java file within src/main/java/mycompany and added a method that sets up the property:

package mycompany;

public class Setup {
    public void browserSetup() {
        System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
    }
}

Then, in my test, I imported this as a library:

*** Settings ***
Library  Selenium2Library
Library  automated_tests.Setup

And then invoked the method as a new keyword: Browser Setup.

That was it. I ran it and it worked.

I actually found out how to do it:

I created a .java file within src/main/java/mycompany and added a method that sets up the property:

package mycompany;

public class Setup {
    public void browserSetup() {
        System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
    }
}

Then, in my test, I imported this as a library:

*** Settings ***
Library  Selenium2Library
Library  mycompany.Setup

And then invoked the method as a new keyword: Browser Setup.

That was it. I ran it and it worked.

Source Link
Floella
  • 319
  • 1
  • 7
  • 14

I actually found out how to do it:

I created a .java file within src/main/java/mycompany and added a method that sets up the property:

package mycompany;

public class Setup {
    public void browserSetup() {
        System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
    }
}

Then, in my test, I imported this as a library:

*** Settings ***
Library  Selenium2Library
Library  automated_tests.Setup

And then invoked the method as a new keyword: Browser Setup.

That was it. I ran it and it worked.