--- selenium.server/src/org/netbeans/modules/selenium/server/Bundle.properties +++ selenium.server/src/org/netbeans/modules/selenium/server/Bundle.properties @@ -18,3 +18,10 @@ displayName_Startup=Start on NetBeans startup desc_Startup=start server on NetBeans startup or not. Note \ that server must be running to run Selenium tests correctly. + +displayName_FirefoxProfile=Firefox Profile +desc_FirefoxProfile=The profile directory for Firefox + +displayName_SingleWindow=Single Window +desc_SingleWindow=Should the browser started by selenium server use
\ +multiple frames in a single window or multiple windows. --- selenium.server/src/org/netbeans/modules/selenium/server/SeleniumProperties.java +++ selenium.server/src/org/netbeans/modules/selenium/server/SeleniumProperties.java @@ -64,6 +64,8 @@ public static int seleniumDefaultPort = -1; public static final String PORT = "Port"; public static final String START_ON_STARTUP = "Startup"; + public static final String FIREFOX_PROFILE = "FirefoxProfile"; + public static final String SINGLE_WINDOW = "SingleWindow"; private static InstanceProperties instanceProps; private static final String NAMESPACE = "Selenium server properties namespace"; //NOI18N @@ -73,6 +75,8 @@ Set set = sheet.get(Sheet.PROPERTIES); set.put(new ServerIntProperty(PORT, props)); set.put(new ServerBoolProperty(START_ON_STARTUP, props)); + set.put(new ServerStringProperty(FIREFOX_PROFILE, props)); + set.put(new ServerBoolProperty(SINGLE_WINDOW, props)); return sheet; } @@ -114,6 +118,8 @@ instanceProps = manager.createProperties(NAMESPACE); instanceProps.putInt(PORT, getSeleniumDefaultPort()); instanceProps.putBoolean(START_ON_STARTUP, true); + instanceProps.putString(FIREFOX_PROFILE , ""); + instanceProps.putBoolean(SINGLE_WINDOW , false); allProps.add(instanceProps); } } @@ -161,8 +167,26 @@ } + private static final class ServerStringProperty extends ServerProperty { + public ServerStringProperty(String propertyName, InstanceProperties props) { + super(String.class, propertyName, props); + } + @Override + public String getValue() throws IllegalAccessException, InvocationTargetException { + return props.getString(getName(), ""); + } + + @Override + protected void writeNewValue(String val) { + props.putString(getName(), val); + } + + } + + + private static abstract class ServerProperty extends Node.Property{ protected InstanceProperties props; --- selenium.server/src/org/netbeans/modules/selenium/server/SeleniumServerRunner.java +++ selenium.server/src/org/netbeans/modules/selenium/server/SeleniumServerRunner.java @@ -42,6 +42,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.io.File; import java.lang.reflect.InvocationTargetException; import java.net.BindException; import java.net.MalformedURLException; @@ -192,6 +193,21 @@ SeleniumProperties.getSeleniumDefaultPort()); //NOI18N remoteControlConfiguration.getMethod("setPort", int.class).invoke( remoteControlConfigurationInstance, port); //NOI18N + boolean runInSingleWindow = ip.getBoolean( + SeleniumProperties.SINGLE_WINDOW, + false); //NOI18N + remoteControlConfiguration.getMethod("setSingleWindow", boolean.class).invoke( + remoteControlConfigurationInstance, runInSingleWindow); //NOI18N + String firefoxProfileDir = ip.getString( + SeleniumProperties.FIREFOX_PROFILE, + ""); + if (!"".equals(firefoxProfileDir)) { + File ffProfileDir = new File(firefoxProfileDir); + if (ffProfileDir.exists()) { + remoteControlConfiguration.getMethod("setFirefoxProfileTemplate", File.class).invoke( + remoteControlConfigurationInstance, ffProfileDir); //NOI18N + } + } server = seleniumServer.getConstructor(remoteControlConfiguration). newInstance(remoteControlConfigurationInstance); }