Skip to content

Commit 876111b

Browse files
committed
[JS] Add code for element information
1 parent ed89a57 commit 876111b

File tree

2 files changed

+59
-15
lines changed

2 files changed

+59
-15
lines changed

examples/javascript/package-lock.json

+15-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const {By, Builder} = require('selenium-webdriver');
2+
const assert = require("assert");
3+
4+
describe('Element Information Test', function () {
5+
let driver;
6+
7+
before(async function () {
8+
driver = await new Builder().forBrowser('chrome').build();
9+
});
10+
11+
beforeEach(async ()=> {
12+
await driver.get('https://www.selenium.dev/selenium/web/inputs.html');
13+
})
14+
15+
it('Check if element is displayed', async function () {
16+
// Resolves Promise and returns boolean value
17+
let result = await driver.findElement(By.name("email_input")).isDisplayed();
18+
19+
assert.equal(result,true);
20+
});
21+
22+
it('Check if button is enabled', async function () {
23+
// Resolves Promise and returns boolean value
24+
let element = await driver.findElement(By.name("button_input")).isEnabled();
25+
26+
assert.equal(element, true);
27+
});
28+
29+
it('Check if checkbox is selected', async function () {
30+
// Returns true if element ins checked else returns false
31+
let isSelected = await driver.findElement(By.name("checkbox_input")).isSelected();
32+
33+
assert.equal(isSelected, true);
34+
});
35+
36+
it('Should return the tagname', async function () {
37+
// Returns TagName of the element
38+
let value = await driver.findElement(By.name('email_input')).getTagName();
39+
40+
assert.equal(value, "input");
41+
});
42+
43+
after(async () => await driver.quit());
44+
});

0 commit comments

Comments
 (0)