Using a properties file as a UI Mapping in java:
in java, since '.' has meaning as an operator, you can't make it look exactly like their example (not sure what they were getting at). you could do something like:
setup code:
public class Config { public static String admin_username; static { Properties props = ...; admin_username = props.getProperty("admin.username"); }}
usage code:
import static Config.*;selenium.type(admin_username, "xxxxxxxx");
if you really got crazy, you could load the Config class using reflection (to remove the boilerplate in the "static" block).
Personally, I don't think it's good practise, but if you want to use it, hey, it's your call.
public class AdminUiMap { public String username; public UiMap(String fileName) { Properties props = new Properties(); props.load(new FileInputStream(fileName)); this.username = props.getProperty("admin.username"); }}
Then, in your test setup, you could do
AdminUiMap admin = new AdminUiMap("adminLocators.properties");
and then you'd really write
selenium.type(admin.username, "xxxxxxxx");
The second option: see this doc. It's a pretty straightforward manual, I'll just point out the single paragraph that is specifically for Selenium RC:
For the Selenium RC, you have two options. The map file may be included in the
user-extensions.js
file specified at startup with the-userExtensions
switch. Or, you may load it dynamically with the variant of thesetUserExtensionJs
command in your driver language, before the browser is started.