diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-27 17:36:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-27 17:36:13 +0200 |
commit | 5f466137ad6ac596600e3ff53c9b786815398445 (patch) | |
tree | f914c221874f0b16bf3def7ac01d59d1a99a3b0b /node_modules/selenium-webdriver/example | |
parent | c9f5ac8e763eda19aa0564179300cfff76785435 (diff) |
node_modules, clean up package.json
Diffstat (limited to 'node_modules/selenium-webdriver/example')
9 files changed, 0 insertions, 477 deletions
diff --git a/node_modules/selenium-webdriver/example/async_await_test.js b/node_modules/selenium-webdriver/example/async_await_test.js deleted file mode 100644 index dd625db34..000000000 --- a/node_modules/selenium-webdriver/example/async_await_test.js +++ /dev/null @@ -1,68 +0,0 @@ -// 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, 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'); - await driver.findElement(By.name('btnG')).click(); - - await driver.wait(until.titleIs('webdriver - Google Search'), 1000); - - let url = await driver.getCurrentUrl(); - assert.equal(url, 'https://www.google.com/#q=webdriver'); - }); -}); diff --git a/node_modules/selenium-webdriver/example/chrome_android.js b/node_modules/selenium-webdriver/example/chrome_android.js deleted file mode 100644 index bc0701cf9..000000000 --- a/node_modules/selenium-webdriver/example/chrome_android.js +++ /dev/null @@ -1,43 +0,0 @@ -// 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, 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'); - yield driver.findElement(By.name('btnG')).click(); - yield driver.wait(until.titleIs('webdriver - Google Search'), 1000); - } finally { - yield driver && driver.quit(); - } -}).then(_ => console.log('SUCCESS'), err => console.error('ERROR: ' + err)); diff --git a/node_modules/selenium-webdriver/example/chrome_mobile_emulation.js b/node_modules/selenium-webdriver/example/chrome_mobile_emulation.js deleted file mode 100644 index 790be2bcf..000000000 --- a/node_modules/selenium-webdriver/example/chrome_mobile_emulation.js +++ /dev/null @@ -1,43 +0,0 @@ -// 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, promise, until} = require('..'); -const {Options} = require('../chrome'); - -promise.consume(function* () { - let driver; - try { - driver = yield new Builder() - .forBrowser('chrome') - .setChromeOptions( - new Options().setMobileEmulation({deviceName: 'Google Nexus 5'})) - .build(); - yield driver.get('http://www.google.com/ncr'); - yield driver.findElement(By.name('q')).sendKeys('webdriver'); - yield driver.findElement(By.name('btnG')).click(); - yield driver.wait(until.titleIs('webdriver - Google Search'), 1000); - } finally { - yield driver && driver.quit(); - } -}).then(_ => console.log('SUCCESS'), err => console.error('ERROR: ' + err)); diff --git a/node_modules/selenium-webdriver/example/firefox_channels.js b/node_modules/selenium-webdriver/example/firefox_channels.js deleted file mode 100644 index b0a30f545..000000000 --- a/node_modules/selenium-webdriver/example/firefox_channels.js +++ /dev/null @@ -1,73 +0,0 @@ -// 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, 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')) - .then(_ => driver.findElement(By.name('btnG')).click()) - .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); -}); diff --git a/node_modules/selenium-webdriver/example/google_search.js b/node_modules/selenium-webdriver/example/google_search.js deleted file mode 100644 index b9b821328..000000000 --- a/node_modules/selenium-webdriver/example/google_search.js +++ /dev/null @@ -1,50 +0,0 @@ -// 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, until} = require('..'); - -var driver = new Builder() - .forBrowser('firefox') - .build(); - -driver.get('http://www.google.com/ncr') - .then(_ => driver.findElement(By.name('q')).sendKeys('webdriver')) - .then(_ => driver.findElement(By.name('btnG')).click()) - .then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000)) - .then(_ => driver.quit()); diff --git a/node_modules/selenium-webdriver/example/google_search_generator.js b/node_modules/selenium-webdriver/example/google_search_generator.js deleted file mode 100644 index 25df93ab9..000000000 --- a/node_modules/selenium-webdriver/example/google_search_generator.js +++ /dev/null @@ -1,50 +0,0 @@ -// 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, 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'); - - let btnG = yield driver.findElement(By.name('btnG')); - yield btnG.click(); - - yield driver.wait(until.titleIs('webdriver - Google Search'), 1000); - } finally { - yield driver && driver.quit(); - } -}).then(_ => console.log('SUCCESS'), err => console.error('ERROR: ' + err)); diff --git a/node_modules/selenium-webdriver/example/google_search_test.js b/node_modules/selenium-webdriver/example/google_search_test.js deleted file mode 100644 index 0ca2f4370..000000000 --- a/node_modules/selenium-webdriver/example/google_search_test.js +++ /dev/null @@ -1,61 +0,0 @@ -// 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, 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')) - .then(_ => driver.findElement(By.name('btnG')).click()) - .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'); - yield driver.findElement(By.name('btnG')).click(); - yield driver.wait(until.titleIs('webdriver - Google Search'), 1000); - }); - - test.after(() => driver.quit()); -}); diff --git a/node_modules/selenium-webdriver/example/logging.js b/node_modules/selenium-webdriver/example/logging.js deleted file mode 100644 index 633ac90c2..000000000 --- a/node_modules/selenium-webdriver/example/logging.js +++ /dev/null @@ -1,35 +0,0 @@ -// 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, 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')) - .then(_ => driver.findElement(By.name('btnG')).click()) - .then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000)) - .then(_ => driver.quit()); diff --git a/node_modules/selenium-webdriver/example/parallel_flows.js b/node_modules/selenium-webdriver/example/parallel_flows.js deleted file mode 100644 index 59ff103fb..000000000 --- a/node_modules/selenium-webdriver/example/parallel_flows.js +++ /dev/null @@ -1,54 +0,0 @@ -// 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>). - */ - -var webdriver = require('..'), - By = webdriver.By, - until = webdriver.until; - -for (var i = 0; i < 3; i++) { - (function(n) { - var flow = new webdriver.promise.ControlFlow() - .on('uncaughtException', function(e) { - console.log('uncaughtException in flow %d: %s', n, e); - }); - - var driver = new webdriver.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'); - driver.findElement(By.name('btnG')).click(); - driver.wait(until.titleIs('webdriver - Google Search'), 1000); - - driver.quit(); - })(i); -} - |