I am trying to use headless with watir on windows 7.
env.rb
if ENV['HEADLESS']
headless = Headless.new
headless.start
at_exit do
headless.destroy
end
end
When I run a test I am getting following error
$ cucumber --profile bat
*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows
Using the bat profile...
No such file or directory - which Xvfb (Errno::ENOENT)
c:/Ruby193/lib/ruby/gems/1.9.1/gems/headless-0.3.1/lib/headless/cli_util.rb:4:in ``'
Any Idea on how to fix this ? or this only works on linux ?
Headless gem works only on Linux. It does not work on Mac or Windows.
Related
Background
I am tasked with replacing our IE based printing logic with Chromium so that we can eventually support running our current server software on Windows Server Core or potentially other operating systems that support .Net Core. My current thought is to either use Chromium embedded framework or to make use of Puppeteer. I am leaning towards the later because I feel it would be easier to port between operating systems.
Issue
Originally it failed to start with an error about sandboxing so I added the no-sandbox flag. Now when I try to load Chromium it fails to start with the exception below stating that it cannot load chrome.dll
PS C:\Program Files (x86)\Google\Chrome\Application>> .\chrome --headless --enable-logging --disable-gpu --screenshot="C:\screen.png" "https://www.chromestatus.com/"
Which yields the following error in the debug.log file:
[0813/133208.016:ERROR:main_dll_loader_win.cc(134)] Failed to load Chrome DLL from c:\Program Files (x86)\Google\Chrome\Application\68.0.3440.106\chrome.dll: The specified module could not be found. (0x7E)
I have checked around the internet and found a few mentions of this error but the suggested fixes don't seem to fix the issue.
I was able to download Chromium 72.0.3592.0 via Chocolatey and the issue is resolved in that version. I tested using Server Core 2016 LTSB.
choco install chromium --pre -y
chrome --headless --disable-gpu --dump-dom --enable-logging https://www.chromestatus.com/ --no-first-run
Edit:
If you are attempting to run Selenium Tests using Docker windowsservercore and chromium: The command line tests of chromium chrome.exe appear to never work from the container command line.
However when you run dotnet test app.csproj or dotnet vstest app.dll inside the container the webdriver successfully starts and drives the browser
This has been reported to the Chromium team. It appears that Chromium 68+ might have issues with Windows Server 2016.
https://bugs.chromium.org/p/chromium/issues/detail?id=873097
I am not able to execute selenium test cases using robotframework through Jenkins.
Installed
Firefox, geekodriver.
Works without using Jenkins.
Getting the exception
WebDriverException: Message: Process unexpectedly closed with status: 1
Its a simple test case that has
*** Settings ****
Library Selenium2Library
*** Test Cases ***
Testing Selenium
Open Browser http://google.com Firefox
Jenkins shell command configuration
pybot test.robot
Install xvfb in the robotframework server. Also use xvfb plugin in Jenkins.
Seems like xvfb is deprecated and heard that there is a vncserver plugin. Need to try this.
Is there any way to run PhantomJS without Selenium?
PhantomJS is a proper standalone program that you can build yourself or get prebuilt binaries of.
Just download the binary corresponding to your operating system from official website and launch it from command-line:
Linux, MacOS:
./phantomjs script.js
Windows:
phantomjs.exe script.js
I am new to Appium. I started using the Appium app, added the simulator app file and lunched the simulator (using "launch"), as described here
I also succeed recording a test on my app and got the Ruby output (is there an PHPUnit option?).
I cannot find any good knowledge base of how can I run/use this test now? (supposed I have already created / recorded a test)
Note: the only close thing I found is this:
bundle exec cucumber features/plain_note.feature
But it uses cucumber. How can I run a simple test just recorder in the inspector?
Here's how to run your Appium Inspector saved ruby boilerplate tests.
1) Start the Appium server in terminal with this, and leave this terminal window open.
$ appium &
2) While the appium server is running in the previous terminal window, open a new terminal window and navigate to the directory where your tests are located and run them with this.
$ ruby "your_test.rb"
That should execute your Appium test you recorded with the Appium inspector.
If you have the Appium GUI running/open, you may have node issues about the same port already in use. If this happens simply run this in terminal.
$ killall node
If you don't already have the appium server installed you can install it by running this in terminal which requires npm to be installed.
$ npm install -g appium
Hope this helps.
I'm trying to set up testing for a Web app using behaving, which runs on top of behave and splinter - the latter of which in turn uses Selenium to drive PhantomJS. All of this is inside a VirtualBox-provided Vagrant box running CentOS 6.4. I've installed Selenium via pip, and I've installed PhantomJS from the Nux Dextop repo.
Trying to run my tests freezes Behave for 30 seconds, then raises:
selenium.common.exceptions.WebDriverException: Message: 'Can not connect to GhostDriver'
I think I've nailed it down to not being able to open a socket, and indeed, when I try to do this from the Python interactive shell, I can't open any socket to localhost at all. How do I get my tests to run?
I just had the same problem with the Can not connect to GhostDriver error. When trying phantomjs --help, I got the error
[WARNING] Unable to load library icui18n "Cannot load library icui18n: (libicui18n.so.48: cannot open shared object file: No such file or directory)"
After installing libicu48 (Ubuntu package), phantomjs --help gave me
[WARNING] phantomjs: cannot connect to X server
This made sense, since I didn't have an X server installed. Then, I discovered that phantomjs <= 1.4 requires an X server, but >= 1.5 is pure headless. So, instead of relying on my distro's phantomjs package, I installed it using npm, and now everything works fine.
I have installed the package of libicu48 and gnome-session-fallback for the bug.
$ sudo apt-get install libicu48 gnome-session-fallback