Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd9cff2

Browse files
committed
[JS] add code sample for element interactions
1 parent b3d1ae9 commit fd9cff2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const {suite} = require('selenium-webdriver/testing');
2+
const {By, Browser} = require('selenium-webdriver');
3+
const assert = require("node:assert");
4+
5+
suite(function (env) {
6+
describe('Element Interactions', function () {
7+
let driver;
8+
9+
before(async function () {
10+
driver = await env.builder().build();
11+
});
12+
13+
after(async () => await driver.quit());
14+
15+
it('should Clear input and send keys into input field', async function () {
16+
17+
try {
18+
await driver.get('https://www.selenium.dev/selenium/web/inputs.html');
19+
let inputField = await driver.findElement(By.name('no_type'));
20+
await inputField.clear();
21+
await inputField.sendKeys('Selenium');
22+
assert.strictEqual(await inputField.getText(), "Selenium");
23+
} catch (e) {
24+
console.log(e)
25+
}
26+
});
27+
});
28+
}, { browsers: [Browser.CHROME, Browser.FIREFOX]});

0 commit comments

Comments
 (0)