You say you are dynamically extracting the class of the link, does
this mean it is changing in a regular basis?
I'm having a hard time following exactly what your challenge is here,
What do you know, e.g. what is constant each time or predictable each
time? how do you know you've found the link you want to click?
If the pattern is for example a list item with a particular ID, that
contains the link you want, and the class of the link always contains
the text "...strip-close" then you could do something like this
if
browser.li(:id, mainTabsId__CaseDetails').link(:class, /strip-
close/).exists?
browser.li(:id, mainTabsId__CaseDetails').link(:class, /strip-
close/).click
else
puts "FAILED! Could not find Close Button"
return false
end