Raspberry Pi browser won't start on startup - raspbian

I want my browser to start on startup. At the moment it works quite randomly. On some boots the browser flashes quickly and is running in the background. When this happens, I can't start a new browser session before I kill the existing one.
How can I prevent this from happening? I'm currently doing this with a shell script, but I've also tried the autostart method and both give me same results.

Related

Chromium on startup behavior is different that launching it manually

I have a Jetson Nano that runs LXDE. After booting it should automatically start Chromium in kiosk mode and launch a web page. The web page is very simple, just adding and removing some rectangles or images based on web socket messages.
Since sometimes the DOM gets updated, sometimes not, I thought my web page has some bug. But this behavior is only on the Jetson Nano. Furthermore, when I launch the Chromium manually with the exact same parameters, I have no problem at all, everything runs as expected.
I also observed that the Chromium (the autostarted one) instantly updates the DOM correctly when I press Alt+Tab (since it is the only application, no application is really switched). So apparently nothing has happened since the last web socket message, I just press Alt+Tab, and the web page instantly is displaying the correct things. Additionally it is very difficult to bring up the developer console, pressing ctrl+shift+i for several minutes, when you are lucky it fires up the developer console. Once it is there, the web page is again working normally.
I have no idea what I can do about it. I just want to launch the Chrome so it behavior is like when I start it normally.
Currently, the autostart is done inside ~/.config/lxsession/LXDE/autostart with the line #/home/agx/dev/autostart/chromium.sh, this file is:
#!/bin/bash
sleep 60
chromium-browser --new-window --password-store=basic -kiosk --js-flags='--jitless' http://192.168.1.50/index.html
I tried to delay the start hoping it would help but it changed nothing. Same for jitless. I can execute exact this command manually in the console, chromium fires up and behaves normally.
How can I trace this one down?

When macbook is locked, selenium safari tests initiated by Jenkins on the mac wont run

I have made sure that the mac does not sleep by adjusting the settings in the system preferences. Jenkins will start the test on a schedule, the browser comes up but the test fails because the page is blank.
The same test works with no problem if the mac is unlocked or the screen save is not up.
I cannot leave the mac unlocked because the test runs at night and its a security issue.
Has anyone encountered this issue? And have a solution. Please share.
Attaching some logs. This image will give an idea of what I am describing.
You can try to run tests on locked computer when:
you set your display never turn off, when you lock your computer
you made sure, that computer never goes in hibernate or sleeping mode
If it will not work you can use two more possibilities:
run your tests on headless browser. Here is a pretty good explanation how to do it.
run your tests on a remote screen via VNC or RDP
EDIT:
You can try not lock the screen, but instead start the screensaver, and require the screensaver to immediately require a password.

How to ensure that all phantomjs drivers are shut down?

Basically I've created a program using selenium webdriver (phantomjs) and if errors occur I gracefully close the drivers so no unwanted processes are hanging behind the scenes.
My concern though, is what would happen if my program got shut down for some reason (either by the user or the system). The remaining driver processes would hang behind infinitely which could raise some serious issues in the long run.
Is there any way to ensure that whenever I start my program, any existing phantomjs processes will get shut down (or even better, shut them down whenever the program is shut down)?
I'm using selenium webdriver using C# by the way.
You could try:
$ killall phantomjs
https://github.com/karma-runner/karma/issues/191

Logging the output of VBoxHeadless

I want to be able to launch a VM in headless mode and log the outputs of its tty to the command line.
Basically I have a situation where the VM will be launched remotely (hence the command line requirement), but every once and a while, the VM's bootup sequence freezes, and right now there's no way for me to debug why the VM is not booting up properly unless I go there manually and view it in a non-headless mode.
The VM itself does not have a GUI, it just boots into TTY mode.
So is there anyway I can get some debugging output from the TTY while it's headless?
One crazy idea would be using non-headless mode and taking screenshots of the window that opens, but there must be a better way!
You can use the following command to output a PNG file of the current screen, even in headless mode:
vboxmanage controlvm [vmname] screenshotpng screen.png
I am trying to get some integration testing for bootstrapped virtualboxes up and running and ran into the exact same problem. After finding out that VRDP is a dead end, because RDP cannot send text but only bitmaps, I remembered that some cloud providers require grub to output to ttyS0.
What is ttyS0 you ask? It's the serial console of course :-)
Here's how to configure Debian to output to serial console
VirtualBox allows you to redirect the serial port into either a file or a pipe, meaning you should be able to get all the information you desire by simply reading the specified filepath.

Getting black images with selenium.captureScreenshot

I'm executing selenium tests with testng, that are started on a remote system with Selenium RC via hudson (with ssh connection). The remote system is windows xp with MKS Toolkit installed, hence ssh. Tests are NOT executed as a windows service.
I've tried using both captureScreenshot and captureEntirePageScreenshot methods. The first one always produces a black image. The second one creates the correct screen shot but it only works on Firefox and our tests usually pass on Firefox and fail in other browsers, so it is crucial to capture screen shots for the other browsers (mainly IE and Safari). The tests are ran in parallel, with many browser windows open at the same time. I'm not certain if this is what's causing the problem. Any thoughts will be appreciated.
Unfortunately screenshots in Selenium have been problematic from the start in browsers that are not Firefox. This is something that we Selenium Developers have been working on for a while to correct.
The latest work has been updating Snapsie to work in IE. There is a blog post at http://blog.codecentric.de/en/2010/02/remote-screenshots-mit-selenium-und-dem-robot-framework/ that explains what has happened.
I have noticed that if the screen isn't active, i.e. the screensaver has kicked in, it can produce black screenshots.
Edit:
I just had a thought. You can always run Castro to video record your tests and then watch it play back. This is something SauceLabs use to run Selenium in the cloud.
Write a method for this and call that whereever you need to take the screenshot. Use the java.awt package which has been used in selenium. For example, check this site
After setting Windows Auto-Logon, and launching process not as Windows Service, I found how to solve the Remote Desktop with Black Screenshots problem of IEDriverServer.exe, by creating a batch file that disconnects RDP, instead of closing the RDP session with the regular X button:
%windir%\system32\tscon.exe %SESSIONNAME% /dest:console
See more details here:
https://stackoverflow.com/a/24529629/658497
(Although, I would prefer there was a way to run it as the default action, when terminating RDP session with X Windows button).