BrowserStackLocal.exe suddenly stops. Windows 10 - ui-testing

While running some UI tests with selenium, I am running BrowserStackLocal.exe and I use this command:
BrowserStackLocal.exe --key browser stack license
And everything seems to run pretty good but after around half an hour, the process suddenly stops making my selenium tests fail because they can't reach the target URL.
I am running a windows 10 machine.
Has anyone experienced this before?
Thanks in advance.

Related

Sanity Start compiles however localhost:3333 returns nothing

Good day all... I have been having an issue with Sanity for the past 3 days... After running sanity start on my linux vps I get the success message Content Studio successfully compiled! Go to http://localhost:3333 however the link returns nothing - it just loads indefinitely without any error message in my console. I have tried chrome, brave and firefox as well as turning third-party cookies on - I'd appreciate any assistance or ideas as to what the problem may be
If simply re-starting Sanity Studio doesn't work, you might check if there's still a thread running after exiting studio, and if so, terminate the thread and start Studio again.
A simple CLI command that kills the process running on port 3333 is:
lsof -t -i tcp:3333 | xargs kill
I've experienced similar issues with Studio being unresponsive after inadvertently leaving it running when my MBP goes to sleep. When I return, it appears Sanity is still running in the terminal, but there is no browser response and no errors thrown in the terminal.
More resources that might help:
Finding the PID of the process using a specific port?
Find (and kill) process locking port 3000 on Mac

Slowness when running headless Selenium from Jenkins

I've spent about a day looking for solutions around the web to my issue but none work for me.
Here is my scenario:
I am running Selenium scripts with ChromeDriver using pyATS framework on my Ubuntu 18.04 VM. The VM has 4 GB of memory. I also have setup Jenkins on the machine and am trying to run the pyATS script with the pyATS plugin.
When running headless mode from the terminal, the script runs in the same or faster time than non-headless mode. However, when I run in Jenkins on the same machine, I am getting extreme slowdowns. It looks almost as if Jenkins is running my script in sections, with >2 minutes of delay in between steps at random.
I've tried out Xvfb, headless with various chrome options (noproxy, proxy options, gpu disable, etc), increasing heap memory for jenkins, but I always get the same random 2 min of delay in between script steps.
The script doesn't fail - it will complete eventually. But for a step that I expect to take around 2 min, jenkins will take 10 minutes.
I currently don't have a way to increase the memory my VM has, but are there any other solutions that I can try in the meantime?
Found the issue, I had to set the "--proxy-server" for Chrome to the proxy my VM was running behind. For some reason Firefox was working fine without that option so I didn't think to set this option for Chrome.

Jenkins setup for running Selenium test on Ubuntu

I already tried a lot for Jenkins setup on Ubuntu for running selenium test cases. But each time i face problem Like Display error , chrome connection timeout. I tried all the solution on internet (debugging this from last one week). Someone please help in setting up by step by step process (including version compatibility).
Also, test-cases on Ubuntu Jenkins run only on display mode?

Setting up selenium, chromedriver, and wdio mixed with vagrant or docker

I started out trying to learn how to write automated tests for a small project but nothing was working right out of the box. After a couple hours of searching & experimenting I found the right configuration for my project & figured sharing it might help folks in the future.
Here's a small summary of the errors I encountered on this debugging journey:
Using Jasmine & WDIO, send_keys was crashing
It was a Firefox/geckodriver bug, or something like that
WDIO appeared to hang after switching from Firefox to Chrome
Chrome needed to be run in --no-sandbox mode, essentially
I figured my problem was probably stemming from having WDIO execute my tests on my local machine while Selenium was hammering on the browser in a Vagrant VM. So this will mainly be applicable for people using separate environments (vagrant->local, vagrant->vagrant, docker->local, etc) for WDIO & Selenium/Chromedriver. Here is a gist of the configuration file I ended up with.
I started with fanatique/vagrant-selenium-vm and modified it to use Chrome instead of Firefox because send_keys was broken with Firefox/geckodriver at the time of writing. After swapping out the packages, I'd start the tests with wdio but it would appear to hang. Turning on verbose logging showed it trying to start but failing with no explanation why.
[00:06:39] COMMAND POST "/wd/hub/session"
[00:06:39] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.6.2","name":"webdriverio"}}}
It took removing the & from the nohup java ... command in fanatique/vagrant-selenium-vm's setup.sh to see the logs from Selenium in real time, then I was able to see a "only local connections are allowed" message from chromedriver. That led me to a SO post that said to add --whitelisted-ips="" as an arg to chromedriver - but I was still getting the local connections error message. Chrome itself ended up needing a --no-sandbox flag - that allowed WDIO to connect to the chromedriver in Selenium and my tests ran from there.

Selenium with Xvfb and Jenkins throws TimeoutException

I'm trying to setup automatic Selenium tests with Jenkins on a Linux server.
The problem is that all tests fail with:
org.openqa.selenium.TimeoutException: Timed out after 60 seconds waiting for visibility of element located by By.linkText
Each test fails with the fist element expected.
Jenkins has the Xvfb plugin installed, and from the console messages it seems to work:
Xvfb starting$ /usr/bin/Xvfb :1 -screen 0 1024x768x24
I tried to increase the timeout, but it seems its not that the problem.
The tests run fine on windows and on a linux system with display.
The problem is I don't have direct access to the server, so I'm trying to explore all possibilities before I make requests to the sys admins.
To run the tests are used two projects, both seem to deploy fine, but when the tests start its like one project (the backend) is not deployed and some URLs are not found, from here the timeout exception. I'm not very sure how Jenkins behaves in this case, and if it starts one project at a time.
Any ideas? Thanks a lot!
To check if the application under test is running when tests try to access it, you can connect to the test machine via ssh, and take screenshot at the moment when the test runs:
xwd -root | convert xwd:- capture.png
http://inspirated.com/2007/04/02/howto-use-xwd-for-screenshots