Ask a Question

How to Check Clipboard of remote machine from TestLeft test code

SOLVED
jongleur
New Contributor

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.

1 ACCEPTED SOLUTION

Accepted Solutions
jongleur
New Contributor

Re: How to Check Clipboard of remote machine from TestLeft test code

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.

View solution in original post

5 REPLIES 5
AlexKaras
Community Hero

Re: How to Check Clipboard of remote machine from TestLeft test code

Hi,

 

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

I think that this is a generic question of system programming and is irrelevant to TestLeft itself.

Not sure, but maybe something like that will help:

https://www.codeproject.com/Articles/3046/Share-the-Clipboard-Using-NET-Remoting

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdsod/eaebc7cd-a43b-42ac-af4f-bdddbe...

https://www.google.com/search?q=c%23+get+%22remote%22+clipboard+text

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
jongleur
New Contributor

Re: How to Check Clipboard of remote machine from TestLeft test code

Hi Alex,

thanks for the fast response, but I don't think it's a solution.

 

Of course I could implement something on the remote machine, but I guessed it's kind of a standard api of a system and a UI test should IMHO be able to check it as well.

In TestExecute there is sys.Clipboard to get or set the content for that purpose, in TestLeft it's missing.

 

I don't have an RDP session, just the REST api from TestLeft to TestExecute.

AlexKaras
Community Hero

Re: How to Check Clipboard of remote machine from TestLeft test code

Hi,

 

OK, I see your question and the problem.

Unfortunately, all infrastructure (except test log) provided by TestComplete/TestExecute is absent in TestLeft and its implementation is left at the mercy of test code developer.

You may contact Support directly via the https://support.smartbear.com/testleft/message/. Maybe guys will provide you with some solution.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
jongleur
New Contributor

Re: How to Check Clipboard of remote machine from TestLeft test code

thanks.

Did that, and got an idea as response to find the parent of the IProcess to get it's properties - still have to check out if that helps.

jongleur
New Contributor

Re: How to Check Clipboard of remote machine from TestLeft test code

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.

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: