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 gridAdvanced operations Selenium in node
We can below actions using ActionSequence.- Right click on the element
- Drag and drop an element
- Double click on an element
- Simulating mouse over action
var assert = require(‘assert’);
var webdriver = require(‘selenium-webdriver’),
By = webdriver.By,
until = webdriver.until;
var chrome = require(“selenium-webdriver/chrome”);
var options = new chrome.Options();
options.addArguments(“start-maximized”);
options.addArguments(“disable-popup-blocking”);
options.addArguments(“test-type”);
var driver = new webdriver.Builder().
withCapabilities(options.toCapabilities()).build();
driver.get(‘https://www.softpost.org/selenium-test-page/’);
var e3 = driver.findElement(By.tagName(‘select’));
//You can use ActionSequence class to perform actions in selenium
new webdriver.ActionSequence(driver).
keyDown(webdriver.Key.SHIFT).
click(e3).
//dragAndDrop(element3, element4).
keyUp(webdriver.Key.SHIFT).
perform();
//In the same way, you can perform below actions.
//sendKeys, mouseUp , mouseMove, mouseDown, dragAndDrop, doubleClick
driver.sleep(5000);
driver.quit();
//Similarly we can also do touch actions on mobile phones
Web development and Automation testing
solutions delivered!!