Question

I currently run the JBehave Selenium tests on current browser, I use the PropertyWebDriverProvider() to set up my browser. There is my code:

public class PlayerLandingPageRunner extends JUnitStories {

private WebDriverProvider driverProvider = new PropertyWebDriverProvider();
private WebDriverSteps lifecycleSteps = new PerStoriesWebDriverSteps(driverProvider);
private Pages pages = new Pages(driverProvider);
private SeleniumContext context = new SeleniumContext();
private ContextView contextView = new LocalFrameContextView().sized(500, 100);

public PlayerLandingPageRunner() {
    if ( lifecycleSteps instanceof PerStoriesWebDriverSteps ){
        configuredEmbedder().useExecutorService(MoreExecutors.sameThreadExecutor());
        configuredEmbedder().useMetaFilters(asList("-skip"));
    }
}

@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    return new SeleniumConfiguration()
            .useSeleniumContext(context)
            .useWebDriverProvider(driverProvider)
            .useStepMonitor(new SeleniumStepMonitor(contextView, context, new SilentStepMonitor()))
            .useStoryLoader(new LoadFromClasspath(embeddableClass))
            .useStoryReporterBuilder(new StoryReporterBuilder()
                .withCodeLocation(codeLocationFromClass(embeddableClass))
                .withDefaultFormats()
                .withFormats(CONSOLE, TXT, HTML, XML));
}

...

How can I set it up to run on other browsers? IE, Chrome?

Thanks!

Was it helpful?

Solution

You should pass "browser" system property to JVM with one of the values described here.

Here is how you could set up your tests to run on Chrome.

If you are running in command line, just pass it like this

java -Dbrowser=chrome ...

If you are using Eclipse, open Run Configurations, select configuration you use for running tests and append into VM arguments text box -Dbrowser=chrome.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top