2017-09-01 7 views

答えて

0

操作を行う前に、コントロールをポップアップウィンドウに切り替える必要があります。これを使うことで、あなたの問題を解決することができます。

Before opening the popup window get the handle of main window and save it. 

String mwh=driver.getWindowHandle(); 

Now try to open the popup window by performing some action: 

driver.findElement(By.xpath("")).click(); 

Set s=driver.getWindowHandles(); //this method will gives you the handles of all opened windows 

Iterator ite=s.iterator(); 

while(ite.hasNext()) 
{ 
    String popupHandle=ite.next().toString(); 
    if(!popupHandle.contains(mwh)) 
    { 
     driver.switchTo().window(popupHandle); 
     /**/here you can perform operation in pop-up window** 
     //After finished your operation in pop-up just select the main window again 
     driver.switchTo().window(mwh); 
    } 
} 
関連する問題