Hi Christine,
Code exported from Script Developer uses either the Scripting API or the Action API which you can choose from in the export dialog. Typically, you would choose the Scripting API as this is the closest representation of your XML scripts in Java.
XLT's Scripting API provides the same commands as Script Developer and even more. In case you want to do some more sophisticated stuff that is not covered by any of the provided commands, you can use the underlying WebDriver API at any time by calling getWebDriver()
to get the wrapped WebDriver instance in your code.
Unfortunately, you did not give any more details about what did not work in your test. So, let me guide you through this step by step.
1. Please make sure that you have configured the classpath of your Java project in IntelliJ to include the libraries shipped with XLT. A short explanation on how to do so can be found here.
2. Please check if your code compiles without any errors.
3. Make sure that the constructor of your test class uses our DefaultWebDriverFactory
to retrieve the WebDriver instance used in the super()
statement.
import com.xceptance.xlt.engine.util.DefaultWebDriverFactory;
...
public class TBrowse extends AbstractWebDriverScriptTestCase {
public TBrowse() {
super(DefaultWebDriverFactory.getWebDriver(), "http://example.org");
}
}
Starting with XLT 4.10.0, the explicit call to our DefaultWebDriverFactory won't be necessary anymore but for now it is.
Now, lets cover the configuration part.
4. Copy the config
folder of the template testsuite shipped with XLT <XLT_INSTALLATION>/samples/testsuite-template
to your Java project.
5. Open the properties file project.properties
inside the config
folder of your testsuite and add the following:
# Configure XLT to use Chrome
xlt.webDriver = chrome
xlt.webDriver.chrome.pathToBrowser = <PATH_TO_CHROME>
xlt.webDriver.chrome.pathToDriverServer = <PATH_TO_CHROMEDRIVER>
# Configure XLT to use Firefox
xlt.webDriver = firefox
xlt.webDriver.firefox.pathToBrowser = <PATH_TO_FIREFOX>
xlt.webDriver.firefox.pathToDriverServer = <PATH_TO_GECKODRIVER>
The driver servers can be found here for Chrome and here for Firefox. Please note that you don't have to configure the paths to your browsers and/or driver servers if their installations are on your PATH.
A "documentation" of the properties above can be found in the file default.properties
.
Thanks,
Hartmut