Katalon Analytics (beta) – Bringing new insights into test reports. Learn more!

How to add variables to object value ?

I would appreciate if anybody can come up with a solution for the following scenario:

  1. 1) User creates a unique transaction
  2. 2) We store the transaction 'Date/Time' as a variable
  3. 3) Go to the list of transactions
  4. 4) Need to find this particular transaction out of many by using the text() attribute Something like: //div[@class='cx-item-md-3' and contains(text(),'${CheckInTimestamp}')]In our current tool we store the time-stamp as a variable CheckInTimestamp and then try to find and open a transaction containing the same time-stamp.Thanks!

Comments

  • Have you read through this topic: https://forum.katalon.com/questions/using-variables-in-test-objects. In your case you will need to adjust the code a little bit by using xpath instead:

    lnk_EditEvent.findProperty(‘xpath’).setValue(//div[@class=’cx-item-md-3′ and contains(text(), CheckInTimestamp)])
    lnk_EditEvent.findProperty(‘xpath’).setActive(true)

    In the next release, this will be a native support so that you won't have to spend so many efforts in writing code like this.
  • Hi Vinh Nguyen,

    we followed the steps, you suggested but still get an error in the last line of code. Have you ever seen that before ?

    WebUI.click(lnk_EditEvent) > unexpected token: WebUi
    Thanks!
  • Hi, you probably haven't set default alias for WebUIBuiltInKeywords class. Try to add this line:

    import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

    Or use full class name for static click method:

    WebUiBuiltInKeywords.click(lnk_EditEvent)

    Thanks.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!