Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to select the id that is just added and take that id and use it in another screen #25

Open
sandy77-techm opened this issue Sep 10, 2021 · 0 comments

Comments

@sandy77-techm
Copy link

My Scenario:

1)I need to Create a Demand and after creating the Demand the Id will be autogenerated 2)I need to Fetch that id and use it in another screen

Question: While i created the Demand and try to fetch the Id there will be multiple users who will create the Demand at the same time and there will be multiple ids which will get generated. So i need to get only the Id which i have got after creating the Demand . How Do i handle this ....

So Far i have treid to fetch the lastestid only by using HashMap and it should not be done that ways.

My Code which i have used to Fetch the id is:

public static HashMap<String, String> createdValue; public static void FetchID(WebDriver driver) throws InterruptedException {

createdValue = new HashMap<String, String>();

List<WebElement> tableValues = driver.findElements(By.xpath("//table//tr//td[contains(@class,'mat-column-demandId')]//span"));

int tableValueSize = tableValues.size();

WebElement latestId = driver.findElement(By.xpath("(//table//tr//td[contains(@class,'mat-column-demandId')]//span)["+tableValueSize +"]"));



createdValue.put("latestDataId", latestId.getText()); 


System.out.println(createdValue.put("latestDataId", latestId.getText()));



inputEntry(driver, .SearchInputXpath , createdValue.put("latestDataId", latestId.getText()));

}

The above code will only Fetch the latestid but as specified i need to get only the Id for which i have created the Demand and should not fetch the id of a Demand created by someone else.

Any leads on this will be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant