-
-
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] Add code for element information
- Loading branch information
Showing
2 changed files
with
59 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const {By, Builder} = require('selenium-webdriver'); | ||
const assert = require("assert"); | ||
|
||
describe('Element Information Test', function () { | ||
let driver; | ||
|
||
before(async function () { | ||
driver = await new Builder().forBrowser('chrome').build(); | ||
}); | ||
|
||
beforeEach(async ()=> { | ||
await driver.get('https://www.selenium.dev/selenium/web/inputs.html'); | ||
}) | ||
|
||
it('Check if element is displayed', async function () { | ||
// Resolves Promise and returns boolean value | ||
let result = await driver.findElement(By.name("email_input")).isDisplayed(); | ||
|
||
assert.equal(result,true); | ||
}); | ||
|
||
it('Check if button is enabled', async function () { | ||
// Resolves Promise and returns boolean value | ||
let element = await driver.findElement(By.name("button_input")).isEnabled(); | ||
|
||
assert.equal(element, true); | ||
}); | ||
|
||
it('Check if checkbox is selected', async function () { | ||
// Returns true if element ins checked else returns false | ||
let isSelected = await driver.findElement(By.name("checkbox_input")).isSelected(); | ||
|
||
assert.equal(isSelected, true); | ||
}); | ||
|
||
it('Should return the tagname', async function () { | ||
// Returns TagName of the element | ||
let value = await driver.findElement(By.name('email_input')).getTagName(); | ||
|
||
assert.equal(value, "input"); | ||
}); | ||
|
||
after(async () => await driver.quit()); | ||
}); |