Undefined, Undefined in Chrome notification when it starts from Selenium

I am working on automating a website written in Python and am using Angular where there is a lot of evidence. My problem is that Behat does not seem to recognize these notifications, not to mention so that I can interact with them.

I have attached screenshots of what the notification should look like and instead gives an Undefined - Undefined error message.

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 notice

Broken Notification

And here is the video.

+1
source share
1 answer

If I understand everything correctly, you are talking about notifications, not pop-ups. Notifications still remain largely experimental features, and some browsers do not support them. I also assume that browsers that support them have different APIs to call them, none of which are part of the Webdriver API used by Behat.

I'm sure you can find a way for the notification to display the correct data, but you definitely won't be able to interact with it. Here is another answer that supports my thoughts.

I see that Chrome in the video complains about security, this may be a problem, why you get undefined values, the way to solve this problem is to pass this configuration to the selenium session (this is an example of Behat 3 configuration):

 selenium2: browser: 'chrome' capabilities: browser: 'chrome' extra_capabilities: chromeOptions: args: - '--test-type' 

A good question, however, cannot be discarded.

+3
source

Source: https://habr.com/ru/post/984883/


All Articles