I am using Java, and Cucumber for my automation.
In my feature file I have a statement

 And add a room '<x>'

enter image description here
The xml code for selecting rooms is
enter image description here

is

//div[@class='room-holder col-xs-6']/div[@class='group-of-rooms col-xs-24']/div/div[@class='list-group-item'][2]

How can I the in above xpath in order to select the room?

I have tried using

@FindBy(xpath = "//div[@class='group-of-rooms col-xs-24']/div/div[@class='list-group-item']['+x+']")
    public WebElement RoomSelection;

and below method

public void addRoom(String x) {
        utils.waitForElements(RoomSelection, KnowsTestContext.timeout, KnowsTestContext.driver);
        RoomSelection.click();
    }

It always selects the first option.
Is there any way to pass parameters defined in my step definition ?



Source link https://sqa.stackexchange.com/questions/35519/how-can-i-pass-parameter-in-xpath

LEAVE A REPLY

Please enter your comment!
Please enter your name here