symfony / panther

A browser testing and web crawling library for PHP and Symfony
MIT License
2.9k stars 213 forks source link

How to get popup html and control popup window? #529

Closed Mepcuk closed 2 years ago

Mepcuk commented 2 years ago

How to get popup html and control popup window? Anyone have idea how to switch focus to popup window and control it?

Mepcuk commented 2 years ago

` $jsOnePopUpLink = "window.open('https://example.com','mypopuptitle','width=600,height=400')"; $chromeClient->executeScript($jsOnePopUpLink);

    $popupWindow    = $chromeClient->switchTo()->window('mypopuptitle');
    $pageSourceCode = $popupWindow->getPageSource();
    $crawler        = new Crawler($pageSourceCode);`