I am working on automating a website written in Python and using Angular where there are many confirmation notifications. The issue I have is that Behat doesn't seem to recognise those notifications, let alone allow me to interact with them.
I have attached screenshots of what the notification should look like and the Undefined – Undefined error message Behat produces instead.
My scenario:
Then I select the Delete the Media Plan Line Checkbox
And I delete the Media Plan Line
And I select Yes to confirm the deletion
And I select No to confirm the deletion
And my context:
/**
* @Then /^I select the Delete the Media Plan Line Checkbox$/
*/
public function iDeleteMediaPlanLineCheckbox()
{
/**
* @var AddMediaPlan $addMediaPlan
*/
$addMediaPlan= $this->getPage('AddMediaPlan');
$addMediaPlan->deleteMediaPlanLineCheckbox();
}
/**
* @Given /^I delete the Media Plan Line$/
*/
public function iDeleteTheMediaPlanLine()
{
/**
* @var AddMediaPlan $addMediaPlan
*/
$addMediaPlan= $this->getPage('AddMediaPlan');
$addMediaPlan->deleteMediaPlanLines();
}
public function deleteMediaPlanLineCheckbox ()
{
$this->getElement('deleteMediaPlanLineArea')->click();
$this->getSession()->wait(2000);
$element = $this->getElement('deleteMediaPlanLineCheckbox');
$this->scrollWindowToElement($element);
$element->click();
$this->getSession()->wait(4000);
}
public function deleteMediaPlanLines ()
{
$this->getSession()->wait(2000);
$this->getElement('deleteMediaPlanLines')->click();
$this->getSession()->wait(800000);
}
public function deletePopUpYes ()
{
$this->getElement('deletePopUpYes')->click();
$this->getSession()->wait(2000);
}
public function deletePopUpNo ()
{
$this->getElement('deletePopUpNo')->click();
$this->getSession()->wait(2000);
}
Working notification
http://i58.tinypic.com/1z3qpsw.png
Broken notification
And here is the video.
If I understand everything correctly, you are talking about notifications, not popups. Notifications up to this day remain pretty much experimental features and some browsers don't support them. I also assume that the browsers that do support them have different APIs for invoking them, none of which are part of the Webdriver API, which is used by Behat.
I'm sure you can find a way to make the notification display proper details, but you definitely won't be able to interact with it. Here's another answer supporting my thoughts.
I can see that Chrome in the video complains about the security, this might be the problem why you get undefined values, the way to solve this is to pass this config to the selenium session (this is Behat 3 config example):
Nice question though, it shouldn't be downvoted.