Selenium RC using Maven dependency (Selenium-2.0a4.jar)

52 views
Skip to first unread message

Scal

unread,
May 9, 2011, 10:37:01 AM5/9/11
to flex-pilot
Hi;
I'm using Maven to build my Java project, which uses the
Selenium-2.0a4.jar dependency.
I want to update the DefaultSelenium class with the Flex-Pilot
commands but can't because the class if a dependency (not an physical
jar file inside my project); how can I implement Flex-Pilot's
DefaultSelenium?

Should I create my own DefaultSelenium.java class inside my project,
which would extend Selenium's one?

Thanks

Scal

unread,
May 9, 2011, 10:57:17 AM5/9/11
to flex-pilot
These info might be useful to help me:

I create a Selenium object in ParallelRunner.java like this:
public class ParallelRunnableTest
{
private ThreadLocal<Selenium> selenium = new ThreadLocal<Selenium>();
public void startSelenium(Object[] parameter) throws Exception
{
selenium.set(new CustomSelenium('host', 4444, 'browser', 'base
url'));
selenium.get().start();
}

protected Selenium getThreadLocalSelenium()
{
return this.selenium.get();
}
}

My test case classes extends the above:
public class ExampleCaseTest extends ParallelRunnableTest
{

@Test
public void TestCase() throws Exception
{
Selenium selenium = getThreadLocalSelenium();
selenium.click(....);
selenium.flexAssertText("id=testApp",
"chain=name:testTextArea,validator=testing");
}

I created a custom class that extends DefaultSelenium
public class CustomSelenium extends DefaultSelenium
{
public CustomSelenium(String serverHost, int serverPort, String
browserStartCommand, String browserURL) {
super(serverHost, serverPort, browserStartCommand, browserURL);
}

public CustomSelenium(CommandProcessor processor) {
super(processor);
}

public void flexAssertText(String locator,String options) {
commandProcessor.doCommand("flexAssertText", new String[]
{locator,options});
}
}

but the line (selenium.flexAssertText("id=testApp",
"chain=name:testTextArea,validator=testing");) in my test method is
complaining: "The method flexAssertText(String, String) is undefined
for the type Selenium"

Should I implement the Flex-Pilot methods in the Selenium interface
too?
Thanks
Reply all
Reply to author
Forward
0 new messages