Monday, 7 August 2017

Code Example - Frames

package com.seleniumWebdriver;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;

/**
 * @Blog Name : Selenium Code Example
 * @author Deepak Gupta
 * @Created Date 7-08-2017
 *
 */
public class HandlingFrames extends SuperTestNG {

@Test
public void handleFrames() {
try {
driver.get("https://jqueryui.com/tabs/");
WebElement ele = driver.findElement(By.className("demo-frame"));
driver.switchTo().frame(ele);
driver.findElement(By.id("ui-id-3")).click();
logger.info("Tab is clicked");

// Back to default Content
driver.switchTo().defaultContent();
driver.findElement(By.linkText("Demos")).click();
logger.info("Demos link is clicked");
Thread.sleep(5000);
} catch (Exception e) {
e.printStackTrace();
}
}

}

No comments:

Post a Comment

Code Example - File Download By Robot Class In Firefox Browser

Exported from Notepad++ package com . practiceCode ; import java . awt . AWTException ; import java . awt . Robot ; import j...