Selenium + Node
Introduction to Selenium Webdriver Introduction to Node.js Installation and Environment set up NPM – Package Manage for Node.js Directory layout of Selenium Webdriver Node.js package Chrome Chrome with options Chrome in Mobile Emulation IE Firefox Element identification methodsAssertions in Selenium in Node.js Interacting with elements in Selenium in Node.js Basic Browser window automation Sending keys in Selenium in Node.js Synchronization in Selenium Check if Element exists Working with Tables using Selenium Performing advanced actions using Selenium in Node.js Executing JavaScript in Selenium in Node.js Working with multiple Browser Windows or tabs Working with multiple frames Handling alerts Common exceptions in Selenium Taking a screenshot in selenium Mocha – Unit testing framework Selenium gridLaunching chrome in mobile emulation in Selenium in node
Chrome driver allows you to test your web application on emulated mobile devices(Android and iOS). Below example illustrates how to launch chrome in Mobile Emulation using Selenium in Node.js
var assert = require(‘assert’);
var webdriver = require(‘selenium-webdriver’),
By = webdriver.By,
until = webdriver.until;
var chrome = require(“selenium-webdriver/chrome”);
//Below code snippet shows how to launch chrome with mobile emulation mode.
var driver = new webdriver.Builder()
.forBrowser(‘chrome’)
.setChromeOptions(new chrome.Options()
.setMobileEmulation({deviceName: ‘Apple iPhone 5’})
//.setMobileEmulation({deviceName: ‘Google Nexus 5’})
//.setMobileEmulation({deviceName: ‘Google Nexus 7’})
.addArguments(“start-maximized”)
.addArguments(“test-type”)
)
.build();
//Rest of the operations will be done in emulation mode
driver.get(‘https://www.softpost.org/selenium-test-page/’);
driver.quit();
Web development and Automation testing
solutions delivered!!