Search code examples
rubywatirfirewatir

How can I make a variable out of an ID that is made after the item using the ID is created?


The problem I am having is in my testing I create an order which obtains an ID. This ID is different every-time.

Here is a picture of some sample code: alt text

Thanks in advance to any help.

--Curtis


Solution

  • I can't tell exactly by the code provided, but wouldn't something this simple work

    testID = @browser.div(:class, /screenlet-title-bar/).text

    followed by some string manipulation to trim any unnecessary space or characters:

    testID.gsub(" Purchase Order #", "") #Removes leading text