About Random String Verification

In some cases, It need to generate a Random string to SUT, and then will verification sth. that is related to this random string. That means it can’t prepare any image for verify. What can I resove this problem?

For example, we need type a string in a textbox, but the string is random generated, and then will need to verify if this string are exactly typed.

Thanks in advance!

The best way to do this is to copy the text onto the SUT’s clipboard. For example, if the text that you want to verify is in a text box on the SUT, you should be able to select that text, either by clicking or double-clicking in the box, or dragging the mouse across it, or better yet through a menu command shortcut (e.g. cmd-A on a Mac). Then issue a copy command (cmd-C on Mac, ctrl-C on Windows, etc.) to copy that text to the clipboard. The text will then be available to your script by using the RemoteClipboard() function.

Here is some sample code that shows how this works:


-- click in the box (using an image of something outside the box)
Click "TextBox" 

-- select the text
TypeCommand "A"

-- copy the text to the clipboard
TypeCommand "C"

-- get the text from the SUT
get the RemoteClipboard -- (clipboard contents are now in 'it')

-- check the value
if it is not "ExpectedText" then
    LogError "Wrong text!"
end if

I hope this is helpful.