Created
November 22, 2019 18:47
-
-
Save batmi02/68aaa1ea8569c8c0b005f127f4aaad9f to your computer and use it in GitHub Desktop.
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
@Test | |
public void iFrameTest() { | |
// Navigate to the app | |
driver.get("http://localhost:8000/iFrameExample.html"); | |
//----------------- FRAME 1 ------------------------------ | |
// Grab the outermost frame | |
driver.switchTo().defaultContent(); | |
//switch context to outer frameset | |
driver.switchTo().frame("Top"); | |
//switch context to inner iFrame 1 | |
driver.switchTom().frame("1"); | |
//test if the text "One" exists | |
assertEquals("One",driver.findElement(By.id("label")).getText()); | |
//test if the background is green | |
assertThat(driver.findElement(By.tagName("body")).getAttribute("style"), containsString("green")); | |
//----------------- FRAME 2 ------------------------------ | |
// Grab the outermost frame | |
driver.switchTo().defaultContent(); | |
//switch context to outer frameset | |
driver.switchTo().frame("Top"); | |
//switch context to inner iFrame 2 | |
driver.switchTom().frame("2"); | |
//test if the text "Two" exists | |
assertEquals("Two",driver.findElement(By.id("label")).getText()); | |
//test if the background is orange | |
assertThat(driver.findElement(By.tagName("body")).getAttribute("style"), containsString("orange")); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment