Issue
I am writing a code wherein I am retrieving text from a web element and I want to use that same text in other step definition in cucumber. My code is as follows
String researchticketId;
@When("A research ticket with risk rating {int} is created or selected")
public void a_research_ticket_with_risk_rating_is_created_or_selected(Integer int1) {
researchticketId=rs.getrefidlist().get(0).getText();
System.out.println(researchticketId);
WaitActions.wait(3000);
}
@Then("It should be displayed in In research tab with Complexity as No known difficulty")
public void it_should_be_displayed_in_in_research_tab_with_complexity_as_no_known_difficulty() {
rs.gettabslist().get(1).click();
//rs.findresearchticketId(researchticketId);
System.out.println(researchticketId);
WaitActions.wait(5000);
//Assert.assertEquals(researchticketId, rs.getrefidlist().get(0).getText());
}
In Then step, no value is been passed in researchticketId variable. Because of which my tests keep on failing. Can anyone please help me on this?
Solution
It got fixed. I used getAttribute("innerHTML") and it captured by text. This approach is correct by the way.
Answered By - Pratik P
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.