Use other versions of Selenium with Twist
Twist allows Scenarios to be executed with any version of Selenium. Here are the instructions for using any Selenium version with Twist.
Any Selenium version with Twist
- Add selenium-java-client-driver.jar and selenium-server.jar from desired Selenium distribution to the Twist project classpath. It is required to place these jars ahead of other jars in the classpath order in both Twist IDE and in the Ant build.
- Create a factory class that will create a Selenium instance to be used by the test suite.
For example, let us create SeleniumDriverFactory.java in the Twist source folder.
package your.package; import java.io.FileInputStream; import java.util.Properties; import org.openqa.selenium.server.SeleniumServer; import com.thoughtworks.selenium.DefaultSelenium; import com.thoughtworks.selenium.Selenium; public class SeleniumDriverFactory { private SeleniumServer server; private Selenium selenium; public void start() { try { server = new SeleniumServer(); server.start(); selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://<the_URL_of_application_under_test>"); selenium.start(); } catch (Exception e) { throw new RuntimeException(e); } } public void stop() { try { if (selenium != null) { selenium.stop(); } } finally { if (server != null) { server.stop(); } } } public Selenium geSelenium() { return selenium; } } -
You will need to edit the bean definitions with id=seleniumDriverFactory
and id=selenium in applicationContext-suite.xml file to use these new classes as shown below.
<bean id="seleniumDriverFactory" class="your.package.SeleniumDriverFactory" init-method="start" destroy-method="stop" lazy-init="true"/> <bean id="selenium" factory-bean="seleniumDriverFactory" factory-method="getSelenium" lazy-init="true"/> -
Workflow fixtures will now have to depend on the
com.thoughtworks.selenium.Selenium
interface. For example,public NewWorkflow(Selenium selenium) { this.selenium = selenium; }

