We are looking to replace our Selenium approach to automated web data collection and have been recommended Puppeteer or Chromeless.
One of the things I like is the ability to go headless with chrome running on AWS lambda. That reason was sold as the main reason for going with Chromeless or Puppeteer. However, I see posts online indicating that the same can be done with Selenium. If that is true, what over advantages do Chromeless and Puppeteer offer over Selenium ?
We are going to be using NodeJS
Having used both Selenium and Puppeteer, these would be my observations as to why it's currently being recommended so highly:
Puppeteer is really easy to configure and execute. No setting specific drivers required. Just write your test scripts, point node towards your scripts and watch it go. Everything even runs in parallel!
It's a zero setup framework in that it comes bundled with the version of Chromium which it runs best with.
Another benefit is speed. Puppeteer is really fast since it uses headless Chrome.
It integrates very nicely with other popular test frameworks such as jest and mocha.
Using Puppeteers API is really straightforward. Everything is simple to write, easy to understand and basically allows for simple user interactions to be automated using a single line of code.
It's really easy to debug your automation scripts. Simply set headless to false and turn slowMo up from 0 to, say, 250 and you can easily see what's going on and fix any problems you may have.
It's easy to pick up and use no matter what your previous experience levels: on the team I'm working on, everyone (even those with no real automation test script writing experience) has found working with Puppeteer a really nice and relaxed experience. Everyone is getting the grasp of it within a few minutes of basic research and getting scripts running quickly and with no hassle or stress.
It should be noted that Selenium does do everything that Puppeteer does (and vice versa) but that's not the point of Puppeteer. Puppeteer allows for a team to build a large library of automation scripts very quickly using an easy to use API and get tests running now rather than having to deal with building ultra-robust test frameworks which work cross browser and / or cross device.
If you really must have cross browser testing then Selenium or perhaps InternJS (a personal favourite of mine) are still the choices to make.
Puppeteer only supports executing tests on Chrome but, at the end of the day, it's much better to have a lot of tests running (even if it's just on Chrome) as opposed to having none.
Related
I was given the following to consider:
Develop desktop application using Nodeweb kit.
Also develop web application using the same code base.
Applications should look identical.
Both apps must use the same code base. The reason for this is to cut down development expenses.
If it was up to me I would not even consider using node-webkit for desktop. There are far better desktop solutions for Win platforms. For web application using Node is certanly viable.
But people who plan the project somehow think Node is a way to go for both apps.
After lots of thinking, I came to the conclusion that doing what they want will only increase dev and maintenance costs.
I consider using express (maybe even Sails.js) for web application. I made some tests where I used express on node-webkit and it run just fine.
Certanly NW is powerfull platform (popcorn). Just in my case I fail to see how can it cut down the dev expense
Am I right to be against this solution? Is this a plausible decision and I am not seeing another solution?
Any opinion is very welcome
I have actually done exactly this, and it worked very well. The trick was to write some Node Webkit code that will "detect" that it's running as a desktop application, instead of a web app, and thus integrate with desktop notifications etc.
Yes, it was more work than just writing a web app, but it was also less work (and maintenance) than developing separate applications. You get to use a lot of common code, because of the fact that you are running in a browser already, that I feel the project saved a lot of time.
In fact, I am currently working on another application that requires some desktop features (file access, notifications) but the same functionality as the web application, and I'm proposing that the development happens in Node Webkit.
The important criteria here for me is that both applications are 90% the same, the desktop just adds things you don't normally have on the web. So the core of the application is exactly the same AngularJS application, with some JavaScript injected by the Node Webkit startup page to add the required desktop behaviour.
You haven't presented reasons why you think node-webkit is not a suitable option for desktop application.
On the other hand I think client's opinion that development in node and node-webkit will be able to cut down costs is not ungrounded.
nw.js (formerly node-webkit) is basically a Chromium browser with intergrated node.js engine. So if you develop a web-application using node.js (and any of its frameworks) then you will be able to reuse it in nw.js fairly easy.
I've found this nice article about the "injected Way", but the author never finished it :
http://hightechstartups.blogspot.ch/2012/05/different-way-of-developing-browser.html
I would like a bare bone cross browser extension, without any 3rd party extensions or framework (to be as light as possible and not dependant on a 3rd party) that would load Jquery and a JS from a distant server and the ability to load it before or after the page is fully loaded.
I've read a lot of topics about the subject, but since IE10, Chrome 26 and FF20 are out with their new cross-link limitations, i was wondering if somebody had ressources, source code or tutorial about the following requirements :
I need :
Cross browser extension supporting (IE 8+ or 9+ worse case, Chrome
26+, FF20+, Safari)
Ability to inject a single JS hosted on another server. Inserts a script tag that references a javascript file in the head of the HTML
page and then be executed
Not be dependant on a third party extension (greasmonkey) or framework (Kango, Crossrider)
Ability to load before or after the page is fully loaded
This method allows me to customise the browser extension depending on the user's location and it also avoid having updates as the JS is updated on each page refresh.
I'm aware of the downsides, but i would like to achieve this.
I'm aware of cross browser framework like Kango or crossrider, but both don't fit me needs.
The closest example i could find is this How can I run a <script> tag that I just inserted dynamically from a BHO
but it only covers IE and as i got very little Csharp experience, i would like to see a full example to understand it properly and learn from example.
I would LOVE to have a few examples, even if it's not cross-browser (IE being the worst part for me).
Thanks a lot for your support !
Update1:
About Kango and Crossrider, Kango is 2000$ if you want to use IE and for Crossrider you're required to be distributed and monetized by them.
I've managed to code for IE and Chrome, but i was looking for an "elegant" way and figured it was the best place to ask given the level of knowledge of people on this site.
For the installer i currently use NSIS, but i'll test Wix too.
Finally i guess the only way for me would be to learn C++ and .net to get it to work with IE, but if anyone could provide more source code it would be great to test speed and compatibility and discuss here what's the best solution.
Why do Kango or Crossrider not fit your needs? Both frameworks allow you to manipulate the page's DOM (which is what you want):
Kango: Adding content script
Crossrider: documentation, example code
If you want to code your own solution, take a look at the relevant documentation:
Content scripts (Chrome)
The Page mod Jetpack API (Firefox)
Injected scrips (Safari)
Injected scripts (Opera)
Internet Explorer does not natively support extensions. It took me about 80 hours to create a stable and reliable IE extension which supports cross-site AJAX, a (preference) storage method and injection of scripts as early as possible in any frames based on its URL. I developed and tested the extension with Visual Express 2010 on Windows XP and Windows 7, for IE 8-10 (the extension might work on IE6/7, but I decided to not support these ancient and rarely used browsers).
First, I wrote an extension in C# based on LiveReloadIEExtension (a sample IE extension, which in turn is based on this Stack Overflow answer - see also this blog post). It was functional, but it required .NET 4, lacked support of frames, and it's relatively slow.
So, I decided to write an IE extension from scratch in C++. A good starting point is available at http://www.wischik.com/lu/programmer/bho.html: Sample code for C++ BHO, which changes the document's background based on key/mouse events. I've also learned a lot by looking at other code samples on CodeProject, topics on the MSDN forums, questions and answers on Stack Overflow, lots of other blogs, and the MSDN documentation:
DWebBrowserEvents2 interface lists several events which you use to find an appropriate injection point.
Scripting Object Interfaces (MSHTML) lists even more interfaces. You'll be mainly interested in the iHTMLDocument, iHTMLDocument2, ... interfaces.
After creating the IE extension, you want to deploy it of course. I used Wix toolset to create a MSI.
I'd like to start developing Google Chrome extension using node.js (since I've already written a "text-to-song" script in node.js, and I'd like to turn it into a Chrome extension.) What would be the most straightforward way of approaching this problem?
Actually it is. Look at this Developers Live-cast. This is something I've been looking for as well, and this would help you.
This brings your node applications bundled to your browser.
Here is the repo!
EDIT:
I've noticed that this old answer of mine keeps getting upvotes now and then (thank you all).
But nowadays I'm more an advocate of using web apps instead of bundling your application into many platforms like the chrome store or whatever.
You can check the google's post here and here indicating some directions.
In practice I advise for you to start building a progressive web app (PWA) with offline capabilities using service worker and progressive stuff.
There are plenty of resources around the web nowadays and you can offer a much richer application that may achieve a much broader audience if you do it the right way.
Thanks again, and good coding.
Simple answer is NO, unless you can find a way to install node.js with an extension using NPAPI.
Nodejs and a Google Chrome Extension do have a couple things in common i.e they both understand javascript and they both use the v8 javascript engine.
Google Chrome Extension
"Google Chrome Extensions are small software programs that can modify and enhance the functionality of the Chrome browser".
To develop a Google Chrome Extension you should write some javascript and or html/css.
Then you can run the extension in your browser.
If you wish for others to download your extension you will have to provide config.json file that describes you extension sets permissions etc.
Nodejs
"Node.js is a platform built on Google Chrome's JavaScript runtime for easily building fast, scalable network applications".
To develop applications in nodejs you write some javascript and or html/css for web applications.
If wish for others to use you application you start you nodejs server and listen for incoming requests.
Summary
Despite some of the similarities a Google Chrome Extension and Nodejs have nothing to with each other. You cannot use them together in some special way outside of the normal client/server communication.
You can use a WebPack (GitHub) or Browserify (see handbook) to build web-browser extension based on the node.js code.
With Browserify, to convert your code, you can simply run:
browserify node-code.js -o node-code-out.js
Read more:
Browserify vs Webpack.
Build a Chrome Extension with Preact and Webpack (see: Preact Chrome Extension Starter).
I'm upgrading my script from Watir to Watir-Webdriver and I'm wondering how to take advantage of headless-browser testing and grid testing. I've done some research into it but my sources don't seem substantiated, and tutorials are very thin on the ground right now, so has anyone done headless browsing or grid testing? How did you achieve it, and what did you learn that you wish you knew when you started?
I'm working on XP and MS Server '03 VM machines. If I make progress on this I'll try to keep the question updated with information.
I have written a post about how to run Watir-WebDriver heads headlessly using real web browsers in the cloud using Amazon EC2.
See: http://watirmelon.com/2011/08/29/running-your-watir-webdriver-tests-in-the-cloud-for-free/
Have a look at Watir grid https://github.com/90kts/watirgrid might be what you are after.
Hello recently I've been a bit curious and wanted to make a browser. I'd like to use an existing engine though such as Gecko or Webkit. Are there any resources on the web for how to get started and any examples? Language choice doesn't really matter(but no VB please. That was the only example code I found)
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all Internet users to experience the web. This site contains design documents, architecture overviews, testing information, and more to help you learn to build and work with the Chromium source code.
Or study some applications using Webkit for example. Chances are, these projects are not as complex as chromium.
I'd recommend you build a browser in Java with Swing or SWT. They have all the components you'll need, so you need to put them together and start figuring out the tougher problems. The documentation is good, and you may even find tutorials that get you most of the way there.
I recently downloaded the code for Firefox or Chrome, and this seems like a much more difficult place to start. There's lots of setup and overhead to get a build working on your machine compared with a Java app.