-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JS] moving firstscript to run as standlone without tetsing lib [depl…
…oy site]
- Loading branch information
Showing
5 changed files
with
59 additions
and
63 deletions.
There are no files selected for viewing
58 changes: 27 additions & 31 deletions
58
examples/javascript/test/getting_started/firstScript.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
const {By, Builder, Browser} = require('selenium-webdriver'); | ||
const {suite} = require('selenium-webdriver/testing'); | ||
const assert = require("assert"); | ||
|
||
suite(function (env) { | ||
describe('First script', function () { | ||
let driver; | ||
|
||
before(async function () { | ||
driver = await new Builder().forBrowser('chrome').build(); | ||
}); | ||
|
||
after(async () => await driver.quit()); | ||
|
||
it('First Selenium script', async function () { | ||
await driver.get('https://www.selenium.dev/selenium/web/web-form.html'); | ||
|
||
let title = await driver.getTitle(); | ||
assert.equal("Web form", title); | ||
|
||
await driver.manage().setTimeouts({implicit: 500}); | ||
|
||
let textBox = await driver.findElement(By.name('my-text')); | ||
let submitButton = await driver.findElement(By.css('button')); | ||
|
||
await textBox.sendKeys('Selenium'); | ||
await submitButton.click(); | ||
|
||
let message = await driver.findElement(By.id('message')); | ||
let value = await message.getText(); | ||
assert.equal("Received!", value); | ||
}); | ||
}); | ||
}, { browsers: [Browser.CHROME, Browser.FIREFOX]}); | ||
(async function firstTest() { | ||
let driver; | ||
|
||
try { | ||
driver = await new Builder().forBrowser('chrome').build(); | ||
await driver.get('https://www.selenium.dev/selenium/web/web-form.html'); | ||
|
||
let title = await driver.getTitle(); | ||
assert.equal("Web form", title); | ||
|
||
await driver.manage().setTimeouts({implicit: 500}); | ||
|
||
let textBox = await driver.findElement(By.name('my-text')); | ||
let submitButton = await driver.findElement(By.css('button')); | ||
|
||
await textBox.sendKeys('Selenium'); | ||
await submitButton.click(); | ||
|
||
let message = await driver.findElement(By.id('message')); | ||
let value = await message.getText(); | ||
assert.equal("Received!", value); | ||
} catch (e) { | ||
console.log(e) | ||
} finally { | ||
await driver.quit(); | ||
} | ||
}()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters