In the file SeleniumTest.java add the below code
@Test(priority =1)
public void CheckIframes1() throws Exception{
// write your code here
driver.switchTo().frame(driver.findElement(By.id(id:iframe1")));
driver.switchTo().frame(driver.findElement(By.id(id:iframe2")));
driver.findElement(By.xpath(xpathExpression:"button[@class='button+1']")).click();
String coupon = driver.findElement(By.xpath(xpathExpression:"button[@class='button-1']")).getText();
}
@Test(priority =2)
public void CheckIframes2() throws Exception {
// write your code here
driver.switchTo().parentFrame();
driver.switchTo().defaultContent();
Select dropdown = new Select(driver.findElement(By.id(id:"from")));
dropdown.selectByvisibleText("Place 4");
}
@Test(priority =3)
public void CheckIframes3() throws Exception {
//write your code here
driver.findElement(By.id("searchFlightBtn").click();
driver.switchTo().alert().accept();
}
In the cucumber part play.feature file add the below code
Feature : On Flight Booking App
Scenario: working with the Flight Login App
Given find_and_click_the_coupon_button_inside_an_iframe_on_the_right_side_of_the_page_and_get_its_value
when in_the_welcome_abroad_section_select_the_place_value_from_the_from_field_as_'Place_4'
Then click_the_search_flight_button