php - Codeception + PhantomJS: how to open a new tab and switch to it -
i have acceptance test codeception. phantomjs configured webdriver. on page, have link has target="_blank" . problem is, when instruct codeception click on it, not focus on newly opened tab. hence test fails.
code:
$i->click('my link opens new tab'); what have tried:
$i->switchtowindow('title of new window'); // doesn't work $i->see('some text in new tab'); // doesn't work my acceptance.suite.yml:
class_name: acceptancetester modules: enabled: - webdriver - \helper\acceptance config: webdriver: url: 'http://localhost' browser: 'phantomjs' port: 5555 window_size: '1024x768' does have idea?
i have found solution, in case there other suffering developer soul out there:
$i->executeinselenium(function (\facebook\webdriver\remote\remotewebdriver $webdriver) { $handles = $webdriver->getwindowhandles(); $lastwindow = end($handles); $webdriver->switchto()->window($lastwindow); });
Comments
Post a Comment