Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Node.js headless browser with selenium hybrid?

I am curious to know whether anyone out there have tried mixing node.js headless browser packages like zombie.js (any other alternatives?) and selenium browser for testing web applications.

I am attracted to node.js headless browser packages because it's lighter and much faster than driving a full browser via selenium. However, none of the headless browser node packages seem to support accurate rendering of html pages with javascript.

So what about combining best of the both worlds? Revert to using selenium to render pages that zombie.js can't render? How do you go about accomplishing the latter? You'd need to know when a page has not rendered successfully on zombie.js and fire the page on selenium browser. However, wouldn't this create lag in waiting for selenium to bootup?

More importantly, what's the best headless browser node.js package besides zombie.js? Focus should be on page rendering. Do you think we'll ever see a node.js headless browser package replacing selenium in the future?

like image 468
KJW Avatar asked Mar 26 '12 19:03

KJW


People also ask

Does Selenium support headless browser?

Selenium supports headless browser testing using HtmlUnitDriver. HtmlUnitDriver is based on java framework HtmlUnit and is the one of the lightweight and fastest among all headless browser.

How do I run Selenium in headless mode?

You can run Google Chrome in headless mode simply by setting the headless property of the chromeOptions object to True. Or, you can use the add_argument() method of the chromeOptions object to add the –headless command-line argument to run Google Chrome in headless mode using the Selenium Chrome web driver.

Can we use headless browser in cross browser testing?

Headless Browser Testing is a process of running the browser tests without the type of browser UI or GUI. In headless browser testing, to conduct cross-browser testing the tester can run test cases accurately and successfully without requiring the browser on which application needs to be tested.

Is Selenium headless faster?

Improved speed and performance Selenium tests can take a while to complete, due to elements on a page that the browser needs to load. Headless testing gets rid of this load time, allowing you to cut your testing times significantly. In our tests with headless testing, we've seen a 30% reduction of test execution times.


1 Answers

There is a headless testing tool called PhantomJS that is very good at rendering. However, it's not a Node.js package.

I'm also hoping it will be ported to Node.js soon, of find some other package.

like image 117
Sơn Trần-Nguyễn Avatar answered Nov 07 '22 04:11

Sơn Trần-Nguyễn