在acceptance.suite.yml中定义window_size会导致一些问题

时间:2015-10-08 14:09:24

标签: php selenium-webdriver phantomjs qa codeception

我正在使用Codeception与PhantomJS和WebDriver,Selenium Server Standalone。

我使用id,类定义了定位器并且工作完美,但在我添加了window_size参数(即使它是'最大化'或1024x768)之后,测试将失败。

解决方法:我必须使用Firefox中的Inspect Element选项复制并粘贴Unique Locator,而不是简单的id或类定位器。这不是一个大问题,但它不可读,而且有点太大。

显示的错误是:

[实\的webdriver \异常\ TimeoutException异常]

场景步骤:

  1. $ I-> waitForElementVisible("#电子邮件&#34)
  2. $ I-> moveMouseOver("的.login"" Autentificare&#34)
  3. $ I-> amOnPage(" /&#34)
  4. 1 Codeception \ Module \ WebDriver-> waitForElementVisible

    2 /home/laurentiu/PhpstormProjects/codeception/tests/_support/_generated/AcceptanceTesterActions.php:2109

    3 /home/laurentiu/PhpstormProjects/codeception/tests/acceptance/dentstoreCest.php:32

    4 dentstoreCest-> TC_Login_2

    5 /home/laurentiu/PhpstormProjects/codeception/codecept.phar:7

    我的acceptance.suite.yml是:

    class_name:AcceptanceTester

    模块:
      启用:

    - WebDriver
    - \Helper\Acceptance
    

    配置:

      WebDriver:
          browser: phantomjs
          url: "http://example.org"
          window_size: 'maximize'
    

    验收测试的类型是CEST:

    公共职能TC_Login_2(AcceptanceTester $ I)

    {
    
        $I->wantTo('login filling only the email field and the email adress is not registered');
    
        $I->amOnPage('/');
    
        $I->moveMouseOver(".login", 'Autentificare');
    
        $I->waitForElementVisible("#email"); 
    
        $I->fillField("#email", 'asd000000@g.com'); 
    
        $I->click('#SubmitLogin'); 
    
        $I->see('Parola este obligatorie', '.alert.alert-danger'); }
    

    我发现只有在使用moveMouseOver和waitForElementVisible时才会出现此问题。

    谢谢!

0 个答案:

没有答案