Codeception / module-webdriver

WebDriver module for Codeception

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unexpected alert open in chrome

linuxcz opened this issue · comments

  unexpected alert open: {Alert text : Vyplňte pole Heslo}                                                                      
    (Session info: chrome=64.0.3282.186)                                                                                        
    (Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 4.13.0-36-generic x86_64```
> Provide test source code if related

```php
<?php
$I = new SeleniumTester($scenario);
$I->wantTo('Nezadat heslo');
$I->amOnPage('/prihlaseni/');
$I->fillField('login', 'webmaster');
$I->click('_submit');
$I->wait(4);
$I->seeInPopup('Vyplňte pole Heslo');```
### Details

* Codeception version: 2.4.0
* PHP Version: 7.2
* Operating System: VirtualBox Ubuntu
* Installation type: Composer


```yml
actor: SeleniumTester
modules:
    enabled:
      - WebDriver:
          url: http://webserver
          browser: chrome
          host: zalenium
          port: 4444
      - \Helper\Selenium

Some tips?

Did you try to set unexpectedAlertBehaviour capability in WebDriver config?

      - WebDriver:
          url: http://webserver
          browser: chrome
          host: zalenium
          port: 4444
          capabilities:
              unexpectedAlertBehaviour: 'accept'

It was an expected alert.
Probably it is a text matching issue with non-latin characters.

Thank you for yours respond.
I think problem is really in extended-latin characters:
ěščřžýáíé

@DavertMik if i set in WebDriver config file new capabilities have this error:

` [Facebook\WebDriver\Exception\NoAlertOpenException] no alert open
(Session info: chrome=64.0.3282.140)
(Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.13.0-36-generic x86_64)

Scenario Steps:

  1. $I->seeInPopup("Vyplňte pole Heslo.") at tests/akceptacni-testy/selenium/login/004FailBezHeslaCept.php:8
  2. $I->wait(4) at tests/akceptacni-testy/selenium/login/004FailBezHeslaCept.php:7
  3. $I->click("_submit") at tests/akceptacni-testy/selenium/login/004FailBezHeslaCept.php:6
  4. $I->fillField("login","webmaster") at tests/akceptacni-testy/selenium/login/004FailBezHeslaCept.php:5
  5. $I->amOnPage("/prihlaseni/") at tests/akceptacni-testy/selenium/login/004FailBezHeslaCept.php:4

Codeception/Codeception#1 /var/www/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:142
Codeception/Codeception#2 /var/www/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:320
Codeception/Codeception#3 /var/www/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:535
Codeception/Codeception#4 /var/www/vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
Codeception/Codeception#5 /var/www/vendor/facebook/webdriver/lib/WebDriverAlert.php:67
Codeception/Codeception#6 Codeception\Module\WebDriver->seeInPopup
Codeception/Codeception#7 /var/www/tests/akceptacni-testy/_support/_generated/SeleniumTesterActions.php:2068
Codeception/Codeception#8 /var/www/tests/akceptacni-testy/selenium/login/004FailBezHeslaCept.php:8
`

Hi, problem is still not solved:

Screen:

myApp

Here is my code:
$I->login('lokalni', ''); $I->seeInPopup('Vyplňte pole Heslo');
Error
[Facebook\WebDriver\Exception\UnexpectedAlertOpenException] unexpected alert open: {Alert text : Vyplnte pole Heslo.} (Session info: chrome=75.0.3770.100) (Driver info: chromedriver=75.0.3770.8 (681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770@{#40}),platform=Linux 5.0.0-20-generic x86_64)

Capabilities
capabilities: name: 'example' build: '2.0' unexpectedAlertBehaviour: 'accept'

I have the same Problem with an allert with german letter "ö":

 unexpected alert open: {Alert text : Wollen Sie die Diskussion wirklich löschen?}
  (Session info: chrome=79.0.3945.88)
  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64)

In my capabilities:

WebDriver: {
          url: 'https://myapp.com',
          browser: 'chrome',
            chromeOptions: {
              args: [ "unexpectedAlertBehaviour: 'accept'", ..

I an not getting the error, when using the method
I.acceptPopup()