팝업으로 전환 할 때 창 핸들을 제공해야만 할 일을 제어 할 수 있습니다. 이 클래스를 사용하면 앞뒤로 쉽게 전환 할 수 있습니다.
이 C#으로이다 :
WindowManager windowManager = new WindowManager();
windowManager.ParentWindowHandle = driver.CurrentWindowHandle;
//do stuff that opens the new window
//immediately switch focus to the popup so webdriver can work with the page
windowManager.SwitchWindowFocusToPopup(driver, "popup window title");
//do stuff with the popup
//close the popup
driver.Close();
//set the webdriver window back to the original parent window
driver.SwitchTo().Window(windowManager.ParentWindowHandle);`
게시 코드 및 오류 메시지가 도움이 될 것이다 :
는 내 프로그램에서 나는이 작업을 수행. –코드 또는 스크린 샷을 표시하십시오. "팝업 창"으로, 일부는 실제 브라우저 창을 의미하고, 일부는 iframe 팝업, 일부는 HTML div 팝업, 일부는 평균 알림을 의미합니다. 어느 쪽 얘기하고 있니? –
'driver.switchTo(). alert(). accept();'를 사용 했습니까? – Sankumarsingh