I have followed all instructions in the Nightwatch docs and followed many issues in github. I believe I have the correct setup in my nightwatch.json for safari. Safari does launch when I run a test against it but then all the commands in my test fail. For example I have a global beforeEach to resize the browser window which works great in Firefox and Chrome but fails in Safari with
The command 'POST /session/FA198F5F-EE09-4129-9FF0-F55FEA0EE6F0/window/current/size' was not found.
If I remove that then the first step in my test (which is a waitForElementVisible test fails with the error of
The command 'GET /session/FA198F5F-EE09-4129-9FF0-F55FEA0EE6F0/element/node-F5A12DD5-2557-4AE6-806A-0A0B99B63EFC/displayed' was not found.
Again, I'm certain my config is setup properly as nightwatch is launching the safari browser but then failing on the test commands. I have enabled safaridriver and checked 'Allow Remote Automation' but everything still fails. Has anyone run into this issue?
If you used Appium and the XCUITest driver as your WebDriverAgent then you can use browser.execute('mobile:gesture',{arguments}) to replace all the 'Element Interaction' commands. The full list of gestures can be found here
For the command like waitForElementVisible(), you can use the assertions commands instead (in my case I have used assert.visible('element css selector')).
Hope they will change things in NightWatch v2 but for now we can only work around that
Related
I am https://github.com/appium/sample-code
and when I run file at sample-code/sample-code/examples/node/android-simple.js
with command mocha android-simple.js attached is the output with error.
What am I doing wrong here.
This Error will come only when your environment is not set properly..
Make Sure that your Target device(Android Emulator) is up and running and device name that you mentioned in desired capabilities are right
I have been trying to run my tests on phantomjs, directly through mocha, or wdio or gulp, But every time tests dies out with error of timeout. Though tests run perfectly on chrome and firefox, its just in phantomjs I get an error. I have installed phantom js globally and and in my project, but I am unable to get it work since last 2 days.
that's how I have done it the test
before( function (done) {
driver = webdriverio.remote({ desiredCapabilities: {
browserName: 'phantomjs'
} });
driver.init(done);
});
Link to my project : https://github.com/anarwal/asg...
NOTE: I run tests on windows, that is where the problem is, they work fine on MAC
When you use a headless browser you need a selenium server running.
There is an very well explained example using javascript Here.
You may find Chimp.js useful as it easily allows you to use Chrome or FF locally but PhantomJS on the server. See: http://chimpjs.com/
Chimp.js works by "seamlessly integrating CucumberJS / Mocha, Selenium, WebdriverIO and Chai / Jasmine Expect to work in unison. It's designed to take away all the pain that comes with setting up these tools to play nicely together..." - Read more at: https://chimp.readme.io/docs
Everything works fine except there is no output when calling console.log(...) in the Browser window log (Netbeans).
I created a new HTML5 (Cordova Application) project in Netbeans.
I start the android emulator (Intel Atom x86 API Level 19. Galaxy Nexus. With Use Host GPU option checked). Then build/run the project BUILD SUCCESSFUL (total time: 10 seconds) and I can see the app running in the emulator with the 'Device is ready' text blinking.
But there is not console log output. I have made sure the Debugger Console plugin is selected (inside the project properties). I also have added android:debuggable="true" inside <application .../> tag in AndroidManifest.xml file. And still no console log output.
I have also tested with API 21 and still no ouput from console.log
What am I missing?
I'm using cordova 4.3.0, Netbeans 8.0.2, Java version: 1.8.0_45, Apache Ant 1.9.4.
Thanks in advance.
UPDATE: I can see the log entry with DDMS but since I'm using Use Host GPU, Logcat is spammed with an error and by the looks of it, the filter doesn't work as expected and sometimes it stops logging for whatever reason (DDMS). At least I know the console.log call works inside the javascript. By the looks of it, DDMS is buggy.
I think I found out why Netbeans isn't picking up any log output.
Debugger console seems to only work for Xcode and/or maybe Netbeans isn't configured to get any log from LogCat. Cordova redirects console.log calls to their respective platform logger. That's why I can see the log entry just fine with adb logcat -s "CordovaLog" (CordovaLog being the tag to filer).
Edit:
Netbeans doesn't connect fast enough and it doesn't show you earlier logs. I recommend to use Chrome remote debugging instead of Netbeans.
While this is not a direct answer to your question, NetBeans personally recommends that you use Chrome with their extension for HTML5 projects:
https://netbeans.org/kb/docs/webclient/html5-gettingstarted.html
Hope that works for you!
2 things that might help: Make sure you have Cordova plugin called "Debugger Console" in your project
Second thing try to use NetBeans dev build from here . The dev build contains importnant fix - IDs of core Cordova plugins has been changed recently and as a result NetBeans could be removing these plugins from build when building the project.
New User here.
After hours of building my smoke and regression tests, I found out after reading many cases online that phantomjs is known to be a trouble to run with protractor. Jenkins has been running phantomjs for all the tasks it has been given so far.
They need these tests to run as part of ci which does not have a windowing system installed.
So I would appreciate it if there is a recommendation for completely headless browser or a headless chrome(that would be most beneficial) and a step by step to set it up. I already have a conf.js and a e2e.conf.js file. My code works perfectly fine with chrome.
I am on a iMac and selenium webdriver, I believe.
Edit: Problem = protractor doesn't work with phantomjs.
What I have done = use different web elements and googled if anyone has faced a similar situation. Also googled for headless browsers that worked for protractor, unable to find a suitable solution.
If anyone reached here - the answers are outdated.
Chromium (on next release) now supports headless mode. no need to work hard.
You can read more here:
https://developers.google.com/web/updates/2017/04/headless-chrome
Here is an example from command line
chrome \
--headless \ # Runs Chrome in headless mode.
--disable-gpu \ # Temporarily needed for now.
--remote-debugging-port=9222 \
https://www.chromestatus.com # URL to open. Defaults to about:blank.
And you can simply trigger protractor with capabilities for chrome:
Activating chrome language flags when activating from protractor (selenium)
Here is the configuraiton I am using
capabilities: {
'browserName': browserName,
chromeOptions: {
binary: '/Users/guymograbi/Downloads/chrome-mac/Chromium.app/Contents/MacOS/Chromium',
args: ['--headless','--disable-gpu']
}
},
Update - new versions of chrome doesn't require binary property
In my environments I found I can remove the binary property as new version of chrome is available on stable branches
My protractor configuration is
capabilities: {
'browserName': 'chrome',
chromeOptions: {
args: [ '--headless', '--disable-gpu', '--no-sandbox', '--window-size=1920x1200' ]
},
},
And it works smoothly for weeks now. highly recommended.
Update - how to do this in karma is super easy
Using headless chrome in karma is super easy:
browsers: 'ChromeHeadless'
it should work with the chrome loader and everything. more info
Your best bet is to continue with Chrome. With a bit of work you can get it to work via a CI and in a headless manner - we do this using Jenkins and Docker Ubuntu servers which are headless.
You will need to configure Chrome to run headless using XVFB. You can start off by following the gist here https://gist.github.com/addyosmani/5336747
You state you are on a Mac so you can either run the headless tests via Docker on your machine or you could set up a second config for the CI tests.
Another resource http://tobyho.com/2015/01/09/headless-browser-testing-xvfb/
I would continue testing in normal browsers with a head, but would use a remote selenium server as a service - Sauce Labs or BrowserStack, see:
Integration Testing with Protractor, WebdriverJS and Sauce Labs
Running Protractor tests on Browserstack Automate
automate-node-samples
You could run your Protractor tests against CodeShip or Drone.io, both of which offer Chrome and/or Firefox running headless for free. No really...
If you've got Chrome 59+ installed, start Chrome with the following flag:
--headless
please let me know if you need more help, will write the config for you :) enjoy
I started playing around with JSTestDriver tonight and got it to work without too many issues. I attempt use the --browser switch to have it autocapture chrome or firefox on my local system here; however, it always threw an error saying "permission denied". I attempted to run the command using sudo and still the same thing.
java -jar $JSTESTDRIVER_HOME/JsTestDriver-1.3.2.jar --port 4224 --browser /Applications/Firefox.app
I can open Firefox using the above path from Terminal so know that the path is valid.
I feel like I'm missing something simple and small. Has anyone seen this issue and know what I'm missing?
UPDATE 1:
Tried to move Firefox out of the /Applications/ directory and still same issue even running under the super user account (using sudo).
Found my issue.
While /Applications/Firefox.app is what's shown the GUI, the actual executable script for the program is in the /Applications/Firefox.app/Contents/MacOS/firefox file.
Changing the path to the deeper folder resolved the issue.