2017-12-26 45 views
-3

Titel zu handhaben auf der Website: Griff Popup-Fenster für Griff div Pop auf demselben Fenster // Paket bucht Selen-Code;wie Popups

import java.util.concurrent.TimeUnit; 
import org.openqa.selenium.By; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.chrome.ChromeDriver; 


public class Dubai { 
    public static void main(String[] args) throws Exception { 
    System.setProperty ("webdriver.chrome.driver", 
         "C:\\Users\\miyau\\Desktop\\test\\chromedriver.exe"); 
     WebDriver driver = new ChromeDriver(); 
     driver.get("http://www.thomascook.in/"); 
     driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); 
     driver.findElement(By.xpath("//div[text()='Not Now']")).click(); 
     System.out.println("operation complit"); 
     } 
} 
// snapshot of popup## Heading ## 

enter image description here

Antwort

-1

können Sie diesen Code versuchen:

public class Dubai { 
    public static void main(String[] args) throws InterruptedException { 
      try { 

        public static void main(String[] args) throws Exception { 
    System.setProperty ("webdriver.chrome.driver", 
         "C:\\Users\\miyau\\Desktop\\test\\chromedriver.exe"); 
     WebDriver driver = new ChromeDriver(); 

        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 
        WebDriverWait wait=new WebDriverWait(driver,50); 

        driver.manage().window().maximize(); 
        Thread.sleep(500); 

        driver.get("http://www.thomascook.in/"); 
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); 

        driver.switchTo().frame(driver.findElement(By.xpath("//iframe[@class='__st_preview_frame_bpn']"))); 
        System.out.println(driver.findElement(By.xpath("html/body/div[1]/div[2]/div[3]/span")).getText()); 

        driver.findElement(By.id("__st_bpn_no")).click(); 

      } catch (Exception e) { 
       e.printStackTrace(); 
      } 

     } 
}