Hi Rob,
SeleniumSteps is just a utility class, but you are not forced to inherit
from it.
Nothing stops you from creating your own instance of Selenium in your steps:
public class MySteps(){
private Selenium selenium;
@Given("the browser is <browser>")
public void givenBrowser(@Named("browser") String browser){
selenium = createSeleniumFor(browser);
}
}
Note that if using POJOs for Steps, you need to use the StepsFactory:
|||addSteps(||new| |StepsFactory().createCandidateSteps(||new|
|MySteps())); |||
Cheeers
On 07/07/2010 17:21, [email protected] wrote:
> I'm sure this is obvious, and someone else must have tried this, but it's
> not leaping out at me.
>
> I'm evaluating jBehave to use with selenium, and I'd like to be able to
> run each scenario against a different browser. Is there a
> preferred/obvious/simple/deeply painful and convoluted way of doing this?
>
> I'm looking at there maybe needing to be several sets of scenarios, one
> for each browser, and I'd prefer to just give a scenario a list of
> browsers, something like:
>
> Scenario: Successful Login
>
> Given the browser is <browser>
> And the user opens the home page
> And no-one is logged in
> Then the site login page should be displayed
> When the user enters username username
> And the user enters password password
> And the user clicks the login button
> Then the store front page should be displayed for user Rob
>
> Examples:
>
> |browser|
> |firefox|
> |iexplore|
>
>
> This doesn't work in any trivial way, because the LoginSteps class
> inheriting from SeleniumSteps has an immutable member selenium. I've
> looked at the documentation and source for the selenium interface, but I
> can't see how I can achieve this. I can get the Scenario class to create
> the LoginSteps class with a specific browser reference, but that comes
> back to then having several scenarios, duplicated for each browser. Or is
> this a case for a GivenScenario which selects the browser, and subsequent
> scenarios reuse that?
>
> thanks
>
> Rob
>
>
>
> ***********************************************************************************
> This e-mail and attachments are intended for the above name only and may be
> confidential. If they have come to you in error, you must take no action
> based on them, nor must copy or show them to anyone; please reply to this
> e-mail and report the error.
> Security warning: Please note that this e-mail has been created in the
> knowledge that the internet is not a one hundred percent secure communication
> medium. We advise that you understand and observe this lack of security when
> e-mailing us.
> Virus: Although we have taken steps to ensure that this e-mail and
> attachments are free from any virus, we advise that in keeping with good
> practice the recipient should ensure they are actually virus free.
> If you have received this e-mail in error please notify:
> [email protected]
> YELL ADWORKS is a business name of YELL MEDIAWORKS LIMITED
> Registered Office: Queens Walk, Oxford road, Reading, Berkshire, England, RG1
> 7PT.
> Registered in England and Wales, registered number 06649631
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>