Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
mobile-web-browser-emulator
Advanced tools
Emulation of a Chrome-based browser on a mobile device for Node.js
Mobile Web Browser Emulator is a Node.js tool which simulates a Chrome-based browser on a mobile device. This module also allows manipulation via Selenium WebDriver. It is an easy way to test mobile web applications on mobile devices.
This module is used by the new version of the Mobile Checker by W3C.
This application works in headless mode (powered via XVFB). Using it on the server side is easy.
Start by having BrowserMob Proxy set up and running. Then run the following command
npm install mobile-web-browser-emulator
With Mobile Web Browser Emulator, it is easy test mobile web applications using the Selenium WebDriver API.
Emulation example:
var MobileBrowser = require('mobile-web-browser-emulator').MobileBrowser;
var mobileBrowser = new MobileBrowser();
mobileBrowser.emulate(
// Parameters such as dimensions for tablets, smartphones or desktops.
{
url: 'https://www.google.com/', // URL to load. **required**
width: 300, // Width of the device. **optional** (300 by default)
height: 700 // Height of the device. **optional** (300 by default)
},
// The second parameter is a callback that takes a browser instance as an argument
function(browser) { /* ... */ }
);
Methods on the browser
object:
browser.do(function(driver) {
// The driver object can then be used with Selenium WebDriver
});
browser.takeScreenshot('example.png');
Manipulation with Selenium example :
var MobileBrowser = require('../lib/index.js').MobileBrowser;
var mobileBrowser = new MobileBrowser();
mobileBrowser.emulate({
url: 'https://www.google.com',
width: 300,
height: 700
}, function(browser) {
browser.do(function(driver) {
driver.getTitle().then(function(title) { // Selenium Webdriver Method
console.log(title);
});
});
});
Screenshot example:
var MobileBrowser = require('../lib/index.js').MobileBrowser;
var mobileBrowser = new MobileBrowser();
mobileBrowser.emulate({
url: 'https://www.google.com',
width: 300,
height: 700
}, function(browser) {
browser.takeScreenshot(__dirname + "/../screenshot.png");
});
Copyright (c) 2014 Dominique Hazael Massieux, Guillaume Baudusseau
MIT
FAQs
Emulation of a Chrome-based browser on a mobile device for Node.js
The npm package mobile-web-browser-emulator receives a total of 4 weekly downloads. As such, mobile-web-browser-emulator popularity was classified as not popular.
We found that mobile-web-browser-emulator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.