[Python] Find a generated ID and its status in a page using robot framework

Discussão em 'Python' iniciado por Stack, Janeiro 21, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new here and I'm trying out my first automated scripts using Robot Framework.

    I'm trying to create a keyword test that will create and send out a notification to some users, but at the end of the process, I need to find that created notification by ID, so I can ensure that its status now equals Sent.

    Right now my keyword test is working, but it's just creating the notification and validating the success message at the end. I would like to include one more validation as mentioned before, find the notification by the generated ID and check if the status column for that ID equals Sent.

    I've managed to store the generated ID into a variable during the notification creation process, but now I need to find that ID on a page with a table containing a bunch of other IDs and their statuses.

    For now, I just added the following at the end to try to get that:

    Wait until page contains element ${sentstatus)


    the XPath for that is:

    //a[contains(@href,'/cms/Notifications/Edit/') and text() = 'Sent']


    The problem with this XPath is that it will find a bunch of results since I'm not passing the generated ID, otherwise, it would work, for example:

    //a[contains(@href,'/cms/Notifications/Edit/123456') and text() = 'Sent']


    It would be great if I could add my variable containing the generated ID into that XPath, but that seems like something that is not supported, for example:

    //a[contains(@href,'/cms/Notifications/Edit/${notificationID}') and text() = 'Sent']


    Sorry if that might be a simple question for some of you guys, but I'm really stuck here, please help me lol

    Thanks in advance!

    Continue reading...

Compartilhe esta Página