2017-06-20 4 views
0

私はhttps://testinternal.com/login(内部ウェブサイト)にログインしようとしましたが、次のエラーが表示されました。私はFirefoxの開発者がテキストフィールドの名前を確認するために使用した、フィールド名はユーザー名とパスワードフィールドで正しいです。それがなぜ失敗したのか?フィールド名が正しくてもログインできませんでした

13:40:34.128 INFO - 実行:[取得:https://testinternal.com]) 13:40:34.249 INFO - 完了:[取得:https://testinternal.com/logon] 13:40:34.251 INFO - 実行:[要素を見つける:によって。 xpath: //html/.// [self :: input | self :: textarea | self:select] [((./@ type = 'submit'または./@type = 'image'または./@type = 'hidden')] [(((./@ id = 'username' ./@name = 'username')または./@id = // label [正規化スペース(文字列(。))、 'username')]/@ for)または ./@placeholder = 'ユーザー名])] | .//ラベル[normalize-space(文字列(。))、 'username')] //.// [self :: input | self :: textarea | self:select [not(./@ type = 'submit'または./@type = 'image'または./@type = 'hidden')]])13:40:34.270情報 - 完了:要素を見つける:By.xpath: //html/.// [self :: input | self :: textarea | self:select] [((./@ type = 'submit'または./@type = 'image'または./@type = 'hidden')] [(((./@ id = 'username' ./@name = 'username')または./@id = // label [正規化スペース(文字列(。))、 'username')]/@ for)または ./@placeholder = 'ユーザー名])] | .//ラベル[normalize-space(文字列(。))、 'username')] //.// [self :: input | self :: textarea | 自己::選択] [しない(./@タイプ= '送信' または./@type = 'イメージ' または./@type = '隠された')]]

Feature: Sign in to the website 
    In order to access the administrative interface 
     As a visitor 
     I need to be able to log in to the website 

    @javascript 
     Scenario: Log in with username and password      # features/signin.feature:7 
     Given I am on "/logon"          # Behat\MinkExtension\Context\MinkContext::visit() 
     When I fill in the following:         # Behat\MinkExtension\Context\MinkContext::fillFields() 
      | username | testuser | 
      | password | testpwd | 
      Form field with id|name|label|value "username" not found. 
     And I press "Sign in"           # Behat\MinkExtension\Context\MinkContext::pressButton() 
     Then I should be on "http://testinternal.com"     # Behat\MinkExtension\Context\MinkContext::assertPageAddress() 
     And I should see "My Flows"         # Behat\MinkExtension\Context\MinkContext::assertPageContainsText() 

    2 scenarios (2 failed) 
    10 steps (2 passed, 6 skipped, 2 failed) 

答えて

0

私ができます見つけようとしている要素が隠れていることをエラーから確認してください。セレンは、隠された要素との相互作用を提供しません。この問題を解決するには2つのアプローチがあります。

アプローチ

  1. 見えるように要素を待ち。要素が表示されているアクションを確認することができます。

  2. JavaScript Executorをクリックしてください。

JavascriptExecutor JS =(JavascriptExecutor)ドライバ。 js.executeScript( "arguments [0] .click();"、要素);

+0

こんにちは@Monika、はい、JavaScriptベースのアプリケーションです。 #1アプローチをコントロールすることができます。 #2のアプローチでは、このJavaScript Executorをどこに置くべきですか? behat機能ファイルでは? –

+0

あなたのように見える、あなたはちょうど最初のアプローチに従うことができます。先に進んで最初のアプローチに従ってください。私はエラーを見て解決策を与えました。私がbehatと一緒に働いたことがないので、第2のポイントがどのようにbehatに実装されているのかよくわかりません。私は探検し、あなたに知らせることができます。 – Monika

+0

申し訳ありませんが、このアプリケーションは開発チームによって行われているため、#1を制御することはできません。私の仕事はテストケースを自動化することです –

関連する問題