如何存储我从上一个屏幕获取的 lastid 并获取该 ID 并在下一个选项卡中单击该 ID

How to Store the lastid that i get from the previous screen and fetch that id and click the id in the next tab

我的场景:

在创建原点的第一个表格中 - 我输入所有输入,例如原点等并保存并保存

生成动态 ID

第二个屏幕正在为原点创建计划 -

1)在创建屏幕中有一个搜索选项,所以我使用之前创建的 Origin 进行搜索并将其映射到计划屏幕

2) 保存后,我导航回网格,其中所有行都添加了映射到计划的来源信息,还包含每个来源的动态 ID。

3) 我已阅读 table 并单击包含 OriginName 为“ORIGI”的行,如下所示

List<WebElement> OriginName = driver.findElements(By.xpath("//table[contains(@class,'mat-table')]//tr"));
int countrow = OriginName .size();

        for(WebElement originname:OriginName )
        {
            String text ="//td[contains(normalize-space(),'ORIGI')]";
            
            {
                
                WebElement id = originname.findElement(By.xpath(text));
                        
                id.click();
                break;
            }
        }

然后它再次导航到计划屏幕并单击“发送建议”。

问题:

实际问题从这里开始:

然后我必须导航到“待确认”部分。

此部分将包含已发送提案但未确认的所有 ID。

****这里的问题是如何找到提案的 ID

我接受了 table.****

可以添加更多信息...有人可以提供意见...

您可以使用hashmap来存储和获取数据。

将id存入hashmap

    public class CreateOrigin(){
    
    public static HashMap<String, String> createdValues = new HashMap<String, String>();
    
    public void createOrigin(){
    
    //Code generate id
    
    createdValues.put("id", valueOfNewlyCreatedOrigin);
    
    }
   } 

hashmap

获取值
public class pendingConfirmationScreen(){

public String idOfOrigin = CreateOrigin.createdValues.get("id");

//Use idOfOrigin value in your code

}