Conexio amb la api
This commit is contained in:
parent
207c0ba819
commit
b12369cb47
48513 changed files with 7391639 additions and 7 deletions
69
node_modules/selenium-webdriver/example/async_await_test.js
generated
vendored
Executable file
69
node_modules/selenium-webdriver/example/async_await_test.js
generated
vendored
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Example Mocha tests using async/await.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* mocha -t 20000 --harmony_async_await \
|
||||
* selenium-webdriver/example/async_await_test.js
|
||||
*
|
||||
* You can change which browser is started with the SELENIUM_BROWSER environment
|
||||
* variable:
|
||||
*
|
||||
* SELENIUM_BROWSER=chrome \
|
||||
* mocha -t 20000 --harmony_async_await \
|
||||
* selenium-webdriver/example/async_await_test.js
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const {Builder, By, Key, promise, until} = require('..');
|
||||
|
||||
// async/await do not work well when the promise manager is enabled.
|
||||
// See https://github.com/SeleniumHQ/selenium/issues/3037
|
||||
//
|
||||
// 3037 does not impact these specific examples, but it is still recommended
|
||||
// that you disable the promise manager when using async/await.
|
||||
promise.USE_PROMISE_MANAGER = false;
|
||||
|
||||
describe('Google Search', function() {
|
||||
let driver;
|
||||
|
||||
beforeEach(async function() {
|
||||
driver = await new Builder().forBrowser('firefox').build();
|
||||
});
|
||||
|
||||
afterEach(async function() {
|
||||
await driver.quit();
|
||||
});
|
||||
|
||||
it('example', async function() {
|
||||
await driver.get('https://www.google.com/ncr');
|
||||
|
||||
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
||||
|
||||
await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
||||
|
||||
let url = await driver.getCurrentUrl();
|
||||
assert.ok(
|
||||
url.startsWith('https://www.google.com/search'),
|
||||
'unexpected url: ' + url);
|
||||
});
|
||||
});
|
||||
42
node_modules/selenium-webdriver/example/chrome_android.js
generated
vendored
Executable file
42
node_modules/selenium-webdriver/example/chrome_android.js
generated
vendored
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview A basic example of working with Chrome on Android. Before
|
||||
* running this example, you must start adb and connect a device (or start an
|
||||
* AVD).
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {Builder, By, Key, promise, until} = require('..');
|
||||
const {Options} = require('../chrome');
|
||||
|
||||
promise.consume(function* () {
|
||||
let driver;
|
||||
try {
|
||||
driver = yield new Builder()
|
||||
.forBrowser('chrome')
|
||||
.setChromeOptions(new Options().androidChrome())
|
||||
.build();
|
||||
yield driver.get('http://www.google.com/ncr');
|
||||
yield driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
||||
yield driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
||||
} finally {
|
||||
yield driver && driver.quit();
|
||||
}
|
||||
}).then(_ => console.log('SUCCESS'), err => console.error('ERROR: ' + err));
|
||||
42
node_modules/selenium-webdriver/example/chrome_mobile_emulation.js
generated
vendored
Executable file
42
node_modules/selenium-webdriver/example/chrome_mobile_emulation.js
generated
vendored
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview This is an example of emulating a mobile device using the
|
||||
* ChromeDriver.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {Builder, By, Key, promise, until} = require('..');
|
||||
const {Options} = require('../chrome');
|
||||
|
||||
promise.consume(function* () {
|
||||
let driver;
|
||||
try {
|
||||
driver = yield new Builder()
|
||||
.forBrowser('chrome')
|
||||
.setChromeOptions(
|
||||
new Options().setMobileEmulation({deviceName: 'Nexus 5X'}))
|
||||
.build();
|
||||
yield driver.get('http://www.google.com/ncr');
|
||||
yield driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
||||
yield driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
||||
} finally {
|
||||
yield driver && driver.quit();
|
||||
}
|
||||
}).then(_ => console.log('SUCCESS'), err => console.error('ERROR: ' + err));
|
||||
73
node_modules/selenium-webdriver/example/firefox_channels.js
generated
vendored
Executable file
73
node_modules/selenium-webdriver/example/firefox_channels.js
generated
vendored
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview This is an example of working with the different Firefox
|
||||
* release channels. Before running this example, you will need to have
|
||||
* installed Firefox's release, nightly, and developer editions:
|
||||
*
|
||||
* - https://www.mozilla.org/en-US/firefox/channel/desktop/#aurora
|
||||
* - https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly
|
||||
*/
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
const {Builder, By, Key, promise, until} = require('..');
|
||||
const {Channel, Options} = require('../firefox');
|
||||
|
||||
let i = 0;
|
||||
function resposition(driver) {
|
||||
return driver.manage().window().setSize(600, 400)
|
||||
.then(_ => driver.manage().window().setPosition(300 * (i++), 0));
|
||||
}
|
||||
|
||||
function doSearch(driver) {
|
||||
// Start on the base about page.
|
||||
return driver.get('about:')
|
||||
// Reposition so users can see the three windows.
|
||||
.then(_ => resposition(driver))
|
||||
// Pause so users can see the magic.
|
||||
.then(_ => promise.delayed(750))
|
||||
// Now do the rest.
|
||||
.then(_ => driver.get('http://www.google.com/ncr'))
|
||||
.then(_ =>
|
||||
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
||||
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
||||
.then(_ => driver.quit());
|
||||
}
|
||||
|
||||
function createDriver(channel) {
|
||||
let options = new Options().setBinary(channel);
|
||||
return new Builder().forBrowser('firefox').setFirefoxOptions(options).build();
|
||||
}
|
||||
|
||||
// NOTE: disabling the promise manager so searches all run concurrently.
|
||||
// For more on the promise manager and its pending deprecation, see
|
||||
// https://github.com/SeleniumHQ/selenium/issues/2969
|
||||
promise.USE_PROMISE_MANAGER = false;
|
||||
|
||||
Promise.all([
|
||||
doSearch(createDriver(Channel.RELEASE)),
|
||||
doSearch(createDriver(Channel.AURORA)), // Developer Edition.
|
||||
doSearch(createDriver(Channel.NIGHTLY)),
|
||||
]).then(_ => {
|
||||
console.log('Success!');
|
||||
}, err => {
|
||||
console.error('An error occured! ' + err);
|
||||
setTimeout(() => {throw err}, 0);
|
||||
});
|
||||
50
node_modules/selenium-webdriver/example/google_search.js
generated
vendored
Executable file
50
node_modules/selenium-webdriver/example/google_search.js
generated
vendored
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview An example WebDriver script.
|
||||
*
|
||||
* Before running this script, ensure that Mozilla's geckodriver is present on
|
||||
* your system PATH: <https://github.com/mozilla/geckodriver/releases>
|
||||
*
|
||||
* Usage:
|
||||
* // Default behavior
|
||||
* node selenium-webdriver/example/google_search.js
|
||||
*
|
||||
* // Target Chrome locally; the chromedriver must be on your PATH
|
||||
* SELENIUM_BROWSER=chrome node selenium-webdriver/example/google_search.js
|
||||
*
|
||||
* // Use a local copy of the standalone Selenium server
|
||||
* SELENIUM_SERVER_JAR=/path/to/selenium-server-standalone.jar \
|
||||
* node selenium-webdriver/example/google_search.js
|
||||
*
|
||||
* // Target a remote Selenium server
|
||||
* SELENIUM_REMOTE_URL=http://www.example.com:4444/wd/hub \
|
||||
* node selenium-webdriver/example/google_search.js
|
||||
*/
|
||||
|
||||
const {Builder, By, Key, until} = require('..');
|
||||
|
||||
var driver = new Builder()
|
||||
.forBrowser('firefox')
|
||||
.build();
|
||||
|
||||
driver.get('http://www.google.com/ncr')
|
||||
.then(_ =>
|
||||
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
||||
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
||||
.then(_ => driver.quit());
|
||||
47
node_modules/selenium-webdriver/example/google_search_generator.js
generated
vendored
Executable file
47
node_modules/selenium-webdriver/example/google_search_generator.js
generated
vendored
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview An example WebDriver script using generator functions.
|
||||
*
|
||||
* Before running this script, ensure that Mozilla's geckodriver is present on
|
||||
* your system PATH: <https://github.com/mozilla/geckodriver/releases>
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* node selenium-webdriver/example/google_search_generator.js
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {Builder, By, Key, promise, until} = require('..');
|
||||
|
||||
promise.consume(function* () {
|
||||
let driver;
|
||||
try {
|
||||
driver = yield new Builder().forBrowser('firefox').build();
|
||||
|
||||
yield driver.get('http://www.google.com/ncr');
|
||||
|
||||
let q = yield driver.findElement(By.name('q'));
|
||||
yield q.sendKeys('webdriver', Key.RETURN);
|
||||
|
||||
yield driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
||||
} finally {
|
||||
yield driver && driver.quit();
|
||||
}
|
||||
}).then(_ => console.log('SUCCESS'), err => console.error('ERROR: ' + err));
|
||||
60
node_modules/selenium-webdriver/example/google_search_test.js
generated
vendored
Executable file
60
node_modules/selenium-webdriver/example/google_search_test.js
generated
vendored
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview An example test that may be run using Mocha.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* mocha -t 10000 selenium-webdriver/example/google_search_test.js
|
||||
*
|
||||
* You can change which browser is started with the SELENIUM_BROWSER environment
|
||||
* variable:
|
||||
*
|
||||
* SELENIUM_BROWSER=chrome \
|
||||
* mocha -t 10000 selenium-webdriver/example/google_search_test.js
|
||||
*/
|
||||
|
||||
const {Builder, By, Key, until} = require('..');
|
||||
const test = require('../testing');
|
||||
|
||||
test.describe('Google Search', function() {
|
||||
let driver;
|
||||
|
||||
test.before(function *() {
|
||||
driver = yield new Builder().forBrowser('firefox').build();
|
||||
});
|
||||
|
||||
// You can write tests either using traditional promises.
|
||||
it('works with promises', function() {
|
||||
return driver.get('http://www.google.com/ncr')
|
||||
.then(_ =>
|
||||
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
||||
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000));
|
||||
});
|
||||
|
||||
// Or you can define the test as a generator function. The test will wait for
|
||||
// any yielded promises to resolve before invoking the next step in the
|
||||
// generator.
|
||||
test.it('works with generators', function*() {
|
||||
yield driver.get('http://www.google.com/ncr');
|
||||
yield driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
||||
yield driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
||||
});
|
||||
|
||||
test.after(() => driver.quit());
|
||||
});
|
||||
55
node_modules/selenium-webdriver/example/headless.js
generated
vendored
Executable file
55
node_modules/selenium-webdriver/example/headless.js
generated
vendored
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview An example of running Chrome or Firefox in headless mode.
|
||||
*
|
||||
* To run with Chrome, ensure you have Chrome 59+ installed and that
|
||||
* chromedriver 2.30+ is present on your system PATH:
|
||||
* <https://sites.google.com/a/chromium.org/chromedriver/downloads>
|
||||
*
|
||||
* SELENIUM_BROWSER=chrome node selenium-webdriver/example/headless.js
|
||||
*
|
||||
* To run with Firefox, ensure you have Firefox 57+ installed and that
|
||||
* geckodriver 0.19.0+ is present on your system PATH:
|
||||
* <https://github.com/mozilla/geckodriver/releases>
|
||||
*
|
||||
* SELENIUM_BROWSER=firefox node selenium-webdriver/example/headless.js
|
||||
*/
|
||||
|
||||
const chrome = require('../chrome');
|
||||
const firefox = require('../firefox');
|
||||
const {Builder, By, Key, until} = require('..');
|
||||
|
||||
const width = 640;
|
||||
const height = 480;
|
||||
|
||||
let driver = new Builder()
|
||||
.forBrowser('chrome')
|
||||
.setChromeOptions(
|
||||
new chrome.Options().headless().windowSize({width, height}))
|
||||
.setFirefoxOptions(
|
||||
new firefox.Options().headless().windowSize({width, height}))
|
||||
.build();
|
||||
|
||||
driver.get('http://www.google.com/ncr')
|
||||
.then(_ =>
|
||||
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
||||
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
||||
.then(
|
||||
_ => driver.quit(),
|
||||
e => driver.quit().then(() => { throw e; }));
|
||||
35
node_modules/selenium-webdriver/example/logging.js
generated
vendored
Executable file
35
node_modules/selenium-webdriver/example/logging.js
generated
vendored
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Demonstrates how to use WebDriver's logging sysem.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {Builder, By, Key, logging, until} = require('..');
|
||||
|
||||
logging.installConsoleHandler();
|
||||
logging.getLogger('webdriver.http').setLevel(logging.Level.ALL);
|
||||
|
||||
var driver = new Builder().forBrowser('firefox').build();
|
||||
|
||||
driver.get('http://www.google.com/ncr')
|
||||
.then(_ =>
|
||||
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
||||
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
||||
.then(_ => driver.quit());
|
||||
51
node_modules/selenium-webdriver/example/parallel_flows.js
generated
vendored
Executable file
51
node_modules/selenium-webdriver/example/parallel_flows.js
generated
vendored
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
// Licensed to the Software Freedom Conservancy (SFC) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The SFC licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview An example of starting multiple WebDriver clients that run
|
||||
* in parallel in separate control flows.
|
||||
*
|
||||
* This example will only work when the promise manager is enabled
|
||||
* (see <https://github.com/SeleniumHQ/selenium/issues/2969>).
|
||||
*/
|
||||
|
||||
const {Builder, By, Key, promise, until} = require('..');
|
||||
|
||||
for (var i = 0; i < 3; i++) {
|
||||
(function(n) {
|
||||
var flow = new promise.ControlFlow()
|
||||
.on('uncaughtException', function(e) {
|
||||
console.log('uncaughtException in flow %d: %s', n, e);
|
||||
});
|
||||
|
||||
var driver = new Builder().
|
||||
forBrowser('firefox').
|
||||
setControlFlow(flow). // Comment out this line to see the difference.
|
||||
build();
|
||||
|
||||
// Position and resize window so it's easy to see them running together.
|
||||
driver.manage().window().setSize(600, 400);
|
||||
driver.manage().window().setPosition(300 * i, 400 * i);
|
||||
|
||||
driver.get('http://www.google.com');
|
||||
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
||||
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
||||
|
||||
driver.quit();
|
||||
})(i);
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue