How to use the selenium-webdriver.Key function in selenium-webdriver

To help you get started, we’ve selected a few selenium-webdriver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LLK / scratch-gui / test / helpers / selenium-helper.js View on Github external
constructor () {
        bindAll(this, [
            'clickText',
            'clickButton',
            'clickXpath',
            'elementIsVisible',
            'findByText',
            'findByXpath',
            'getDriver',
            'getSauceDriver',
            'getLogs',
            'loadUri',
            'rightClickText'
        ]);

        this.Key = webdriver.Key; // map Key constants, for sending special keys
    }
github tastejs / todomvc / tests / page.js View on Github external
'use strict';

var webdriver = require('selenium-webdriver');
var until = require('selenium-webdriver/lib/until');

var idSelectors = true;
var classOrId = idSelectors ? '#' : '.';

var DEFAULT_TIMEOUT = 3000;
var REMOVED_TIMEOUT = 100;

var REMOVE_TEXT_KEY_SEQ = Array(51).join(webdriver.Key.BACK_SPACE + webdriver.Key.DELETE);

// Unique symbols
var ELEMENT_MISSING = Object.freeze({});
var ITEM_HIDDEN_OR_REMOVED = Object.freeze({});

module.exports = function Page(browser) {
	// CSS ELEMENT SELECTORS

	this.getMainSectionCss = function () { return classOrId + 'main'; };

	this.getFooterSectionCss = function () { return 'footer' + classOrId + 'footer'; };

	this.getClearCompletedButtonCss = function () { return 'button' + classOrId + 'clear-completed'; };

	this.getNewInputCss = function () { return 'input' + classOrId + 'new-todo'; };
github vitalets / autotester / node-selenium / prepare.js View on Github external
'use strict';

const webdriver = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const test = require('selenium-webdriver/testing');
// const assert = require('selenium-webdriver/testing/assert');
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');

chai.use(chaiAsPromised);

global.test = test;
global.assert = chai.assert;
global.By = webdriver.By;
global.Key = webdriver.Key;
global.until = webdriver.until;

test.before(function () {
  // use chromedriver with full logging
  const service = new chrome.ServiceBuilder('/Users/vitalets/projects/chromium/src/out/Default/chromedriver')
    .usingPort(9516)
    .loggingTo('./log.txt')
    .enableVerboseLogging()
    .build();

  chrome.setDefaultService(service);

  const options = new chrome.Options();
  options.addExtensions('../visbookmarks-chrome/out/yandex.crx');

  //const logging = webdriver.logging;
github guardian / scribe / test / plugins / smart-lists-plugin.spec.js View on Github external
beforeEach(function () {
          var goToStart = new webdriver.ActionSequence(driver)
            .click(scribeNode)
            .sendKeys(webdriver.Key.LEFT)
            .sendKeys(webdriver.Key.LEFT)
            .sendKeys(webdriver.Key.LEFT)
            .sendKeys(webdriver.Key.LEFT)
            .sendKeys(webdriver.Key.LEFT)
            /**
             * Due to an issue with Selenium when running Firefox 22, 24, and
             * 25, we need to send the prefix as individual keys.
             * TODO: revisit at a later date
             */
             // .sendKeys(prefix)
            .sendKeys(prefix[0])
            .sendKeys(prefix[1])
            .perform();

          return goToStart;
        });
github guardian / scribe / test-old / inline-elements-mode.spec.js View on Github external
beforeEach(function () {
          return scribeNode.sendKeys(webdriver.Key.RETURN);
        });
github semantic-machines / veda / qa / testSendGet.js View on Github external
profile.updatePreferences(drv.browser);
        var driver = basic.getDriver(drv);
        basic.openPage(driver, drv);

        //driver = new FirefoxDriver(profile);

        //basic.login(driver, 'karpovrt', '123', '2', 'Администратор2');

        var login = 'karpovrt', password = '123',  firstName = '2', lastName = 'Администратор2';
        driver.findElement({css:'input[id="login"]'}).sendKeys(login).thenCatch(function (e) {
            errrorHandlerFunction(e, "****** PHASE#1 : ERROR = Cannot input login")});
        driver.findElement({css:'input[id="password"]'}).sendKeys(password).thenCatch(function (e) {
            errrorHandlerFunction(e, "****** PHASE#1 : ERROR = Cannot input password")});
        driver.findElement({css:'button[id="submit"]'}).click().thenCatch(function (e) {
            errrorHandlerFunction(e, "****** PHASE#1 : ERROR = Cannot submit login/password")});
        driver.findElement({css:'button[id="submit"]'}).sendKeys(webdriver.Key.ENTER).thenCatch(function (e) {})
            .thenCatch(function (e) {errrorHandlerFunction(e, "****** PHASE#1 : ERROR = Cannot press enter")});
        driver.sleep(basic.EXTRA_SLOW_OPERATION * 2);
        driver.wait
        (
            webdriver.until.elementIsVisible(driver.findElement({id:'user-info'})),
            basic.FAST_OPERATION
        ).thenCatch(function (e) {errrorHandlerFunction(e, "****** PHASE#1 : ERROR = Login:Seems 'user-info' is not visible");});
        driver.wait
        (
            webdriver.until.elementTextContains(driver.findElement({id:'user-info'}), firstName),
            basic.FAST_OPERATION
        ).thenCatch(function (e) {errrorHandlerFunction(e, "****** PHASE#1 : ERROR = Login:Cannot find user first name")});
        driver.wait
        (
            webdriver.until.elementTextContains(driver.findElement({id:'user-info'}), lastName),
            basic.FAST_OPERATION
github mdn / learning-area / tools-testing / cross-browser-testing / selenium / google_test_multiple.js View on Github external
driver.sleep(1000).then(function() {
    driver.findElement(By.name('q')).sendKeys(webdriver.Key.TAB);
  });
github klembot / twinejs / tests / selenium / story-edit.js View on Github external
'use strict';
var _ = require('underscore');
var assert = require('selenium-webdriver/testing/assert');
var firefox = require('selenium-webdriver/firefox');
var key = require('selenium-webdriver').Key;
var phantomjs = require('selenium-webdriver/phantomjs');
var test = require('selenium-webdriver/testing');
var until = require('selenium-webdriver').until;
var helpers = require('./helpers');

test.describe('StoryEditView', function() {
	var dr;
	this.timeout(10000);

	test.beforeEach(function() {
		dr = new firefox.Driver();
		dr.manage().window().setSize(1024, 768);
		helpers.createStory(dr, true);
	});

	test.afterEach(function() {
github KnowledgeExpert / selenidejs / built / lib / element.js View on Github external
async pressTab() {
        return this.type(selenium_webdriver_1.Key.TAB);
    }
}