I am a QA Engineer writing a test script. I am attempting to set a URL string variable that is equal to the URL of the current page in a method and call the method containing the variable in a test method.
*Edit**** Originally I thought this was an issue with the variable itself but this is not the case. I have adjusted my question to better represent the problem
When I initiate and define the URL variable in the same class and method as the test it works fine
public void RFPsCreatedStatusTest(){
RequestsataGlance.RFPinProgressbtnclick();
RequestsataGlance.CreatedClick();
String url = driver.getCurrentUrl();
System.out.println(url);
Assert.assertTrue(url.contains("url.com"), "Incorrect Page, SR list call status does not match status selected ");
But when I create and call the public void() {} URL method [createdassertion]separately from outside of the test method and class it doesn't work. Thoughts?
@Test
public void RFPsCreatedStatusTest(){
RequestsataGlance.RFPinProgressbtnclick();
RequestsataGlance.CreatedClick();
RequestsataGlance.Createdassertion();
}`