Is there a way to stream xvfb output? - streaming

I have automated robotframework tests that runs via xvfb on a jenkins agent, using firefox.
Sometimes I want to check what robot actually see for debugging.
I have found a solution to capture xvfb output as a video, but it would be great if I could watch xvfb output realtime remotely.
I don't like to use youtube or twitch services, my vision is open the browser at something like http://{jenkins_agent_ip}/xvfb and see what the robot see.
Is there a relatively cheap solution for that?

Related

Porting a pywinauto script from Windows to X11/Xlib

In my organization, I have been using pywinauto to automate some UI procedures that could not be done using the sole command line interface.
In an effort to move away from windows, I am evaluating the effort to port the UI automation script to a Linux environment (our tool has a Linux version, including a similar GUI).
I have had a look at the python-xlib project. But I have the feeling that it is more a framework to develop native X11 applications rather than perform tests on an existing application (I could not find anything like find_window etc...).
Do you have any advice for an X11 framework to automate UI procedures?
Based on several inputs, I finally came up with the following suggestions:
use pywinauto which has some beta level of Linux support (this support is based on pyatspi2).
use directly pyatspi2 to interact with the widgets if they are exposed. To browse through the exposed widgets of the application you want to automate, you can use accerciser.
finally, many framework exist to use only click + keys + mouse locations and are based on image comparison. There are many around, I have not yet tested any of them.
Finally, since my script is meant to run in a docker environment in CI, I installed Xvfb to run the automation in headless mode, without graphics HW.

How to enable Nvidia GPU driver in google cloud virtual machine instance in remote desktop

i am having a small problem which is quite critical actually, i run a Unity instance in a google cloud VM that work as a server for a small social experience in VR.
The thing is, if Unity is running without GPU, it starts clogging the processor and the game kindda fails with many users, that is why i hired a eGPU Tesla P4, also, to run Unity, i must log in with Remote Desktop and hit Play.
The thing is, Windows disables the GPU when you go Remote Desktop, Unity opens without a GPU and the GPU is "Unknown" (in dxdiag), thats why i need to solve the RDP issue, i need to log in without disabling GPU acceleration so unity can open and go full power running my game, the server is like a player that doesnt show for the other clients, since its made in Photon PUN, its a weird hybrid, but it works as expected.
Now i have to solve this performance issue, i hope i am clear.
what i need to do now: log in with hardware acceleration (paying a lot for that online gpu and not using it).
What i have now : i log in without using the GPU, the CPU dies, and im wasting cash on the server.
thanks community!
PS: in a future i will use a headless server.
It seems this is a 'Windows' feature that many people have been complaining about. Basically windows switches to a generic driver when you are connecting via remote desktop. Try using an alternative remote desktop solution such as VNC.
Sources:
https://boinc.berkeley.edu/dev/forum_thread.php?id=7026
https://setiathome.berkeley.edu/forum_thread.php?id=70853

Controlling Google Chrome via Perl script

I was looking for a way to check for changes in a specific URL provided by the user. I wrote a script that I ran at home that can do that successfully using WWW::Mechanize. The thing is, I need to run it in another computer network that has a group policy that blocks all $mech->get($url) requests (it's not firewall problems, I let Perl through), so I thought I'll try and work around this problem by letting Perl control the web browser.
The computers in the network run Google Chrome and IE8 only and I can't install Firefox due to another policy (thought of using WWW::Mechanize::Firefox). I don't want to invoke IE8 in the script because most of the URLs that will be provided will be of websites that don't work well with it, so that leaves me with Chrome only.
Searching for a module that can do that, I only found AnyEvent::Chromi:
which exposes all of the Chrome Extensions API via a websocket connection.
This doesn't work (the policy probably blocks that websocket as well).
Is there another way to work around this problem/control Chrome from within a Perl script?
Is there another way to work around this problem/control Chrome from
within a Perl script?
WWW::Mechanize::Chrome
Like WWW::Mechanize, this module automates web browsing with a Perl object. Fetching and rendering of web pages is delegated to the Chrome (or Chromium) browser by starting an instance of the browser and controlling it with Chrome DevTools.
You can also do this from scratch without using any CPAN modules.
I tested this on Linux (Ubuntu 16.04, Google Chrome version 53) using Unix Domain (UD)
sockets. Unfortunately, it seems Windows does not have UD sockets, but
it should be possible to do same from Windows using named pipes.
First, make sure google-chrome is running in the background. We will
need to create a Chrome App
that will communicate
with a native host through the native messaging
API. The
native host can be any script that reads messages from its STDIN and
returns replies through its STDOUT. I tested both a Python
script and a Perl script.
Now, in order for a standalone Perl script to communicate with the
Chrome browser, it will send request through a UD socket (created by
the native host) to the native host; the native host will then
forward the request to google-chrome through its standard output
pipe. Then the Chrome App (written in JavaScript)
will receive the request. The Chrome App will use the Chrome
JavaScript APIs to get the requested data and return it to the native
host. Finally, the native host forwards the result through the socket to
the Perl script.
As you can see, there are some details required for setting this up, but I can
confirm that it works on my Linux platform. Please let me know if you need more
details.
Since you mentioned IE8, I'm assuming that you're dealing with a Windows system. And since you mentioned that you had considered WWW:Mechanix::Firefox, it sounds like you are not being restricted to just core modules.
Based on that, the only way that I can think of to automate the Chrome broswer would be to use Win32::GuiTest to control the Chrome browser. If you can figure out how to manually drive your testing using only keyboard input (i.e. no mouse), that would make things easier than trying to figure out the mouse emulation to get the cursor to the correct position for various tasks.
I'm not sure if that's necessarily a route that you will like to use or not. It's just the only way that I can think of to accomplish what you want to do with the restrictions that you have to deal with.

Deploying Go App

I have a REST API endpoint written in Go and I am wondering what is the best way to deploy it. I know that using Google App Engine would probably make my life easier in terms of deployment. But, suppose that I want to deploy this on AWS. What options/process/procedures do I have. What are some of the best practices out there? Do I need to write my own task to build, SCP and run it?
One option that I am interested in trying is using Fabric to create deployment tasks.
Just got back from Mountain West DevOps today where we talked about this, a lot. (Not for Go specifically, but in general.)
To be concise, all I can say is: it depends.
For a simple application that doesn't receive high use, you might just manually spin up an instance, plop the binary onto it, run it, and then you're done. (You can cross-compile your Go binary if you're not developing on the production platform.)
For slightly more automation, you might write a Python script that uploads and runs the latest binary to an EC2 instance for you (using boto/ssh).
Even though Go programs are usually pretty safe (especially if you test), for more reliability, you might daemonize the binary (make it a service) so that it will run again if it crashes for some reason.
For even more autonomy, use a CI utility like Jenkins or Travis. These can be configured to run deployment scripts automatically when you commit code to a certain branch or apply tags.
For more powerful automation, you can take it up another notch and use tools like Packer or Chef. I'd start with Packer unless your needs are really intense. The Packer developer talked about it today and it looks simple and powerful. Chef serves several enterprises, but might be overkill for you.
Here's the short of it: the basic idea with Go programs is that you just need to copy the binary onto the production server and run it. It's that simple. How you automate that or do it reliably is up to you, depending on your needs and preferred workflow.
Further reading: http://www.reddit.com/r/golang/comments/1r0q79/pushing_and_building_code_to_production/ and specifically: https://medium.com/p/528af8ee1a58

Run CodeSys V2.3 in batch mode

I'm afraid I'm not making much progress on the 3S forums. So you lot are going to get pestered now!
I'm using 3S Codesys v2.3
I'm trying to create a boot project and do sourcecode download on my build server and I'd like to avoid having any hardware plugged into it. I'm using the following command line to run Codesys:
Build.bat:
"C:\Program Files\3S Software\CoDeSys V2.3\Codesys.exe" OptimusPlcFirmware.pro /cmd Build.cmd /batch
Build.cmd:
echo on
online sim off
project rebuild
online bootproject
online sim
online login
online sourcecodedownload
online logout
online sim off
When I do this I get the windows "has encountered a problem and needs to close, with accompanying Send Error Report / Don't Send buttons"
The boot project has been created succesfully and the sourcecode all seems correct. Can anyone explain what's happening?
Thanks
Matt
I run Twincat 2.11 here which is based on CoDeSys 2.3 but may be my idea can be useful. You cannot go Online (Login) until target (your local runtime as well) is in Running mode. Probably your local runtime is in Config mode and thus doesn't accept login and program download. Switch it to Running and try to run your script again.
Taras
I've tested with CoDeSys 2.3.9.13 and I have a similar issue. It seems that the problem comes from the online sourcecodedownload command.
I didn't know if it is valid to download the source code in the PLC in simulation mode. It looks strange to me. In any case, even if it's not possible it shouldn't crash.
I hope it helps