Working with Frames
Frame HTML code
How to fine out Frame in the page.
public class MultipleWindow {
WebDriver driver;
@BeforeClass
public void launchBroser()
{
System.setProperty("webdriver.chrome.driver", "C:/ChromeDriver/chromedriver_2.41.exe");
driver=new ChromeDriver();
driver.get("D:/Selenium/Website/Frame.html");
}
@Test
public void iframTest()
{
List <WebElement> frameslist= driver.findElements(By.xpath("//frame"));
int i=frameslist.size();
System.out.println(i);// Count Frame size
String currentWindow=driver.getWindowHandle();
WebElement windowLink= driver.switchTo().frame(0).findElement(By.linkText("window"));
windowLink.click();
driver.switchTo().window(currentWindow);// switch to parent window
WebElement frame2=driver.switchTo().frame(1).findElement(By.name("t1"));
frame2.clear();
frame2.sendKeys("Yogendrasingh Thakur");
}
Output-
No comments:
Post a Comment