Forum Discussion

jongleur's avatar
jongleur
New Contributor
3 years ago
Solved

How to Check Clipboard of remote machine from TestLeft test code

I'd like to make sure the right content is copied to the clipboard in a TestLeft test

When the Application under test (WPF application) is executed locally, this can be done with the following (C#) code snippet:

 

string clipboard = string.Empty;

Thread thread = new Thread(() => clipboard = System.Windows.Clipboard.GetText());
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
Assert.Equal("0461-002 | 0017 - 00 | 02-40-50 A 001", clipboard);

but that get's the content of the local clipboard where the xunit test is executed.

Using a RemoteDriver it doesn't get the correct result of course.

 

Is there any way to access the clipboard of the remote machine?

I failed yet to find something e.g. in Driver.Desktop.

  • Found a solution with help of the payed support:

    • - Get the IProcess Node of the application under test
    • - Get it's Parent node (which is the Sys object)
    • - use GetProperty<string>("ClipBoard") (which works for string content of the clipboard; didn't test yet for binary/image content).

    Thanks for your help anyway.

5 Replies