簡體   English   中英

behat使用javascript失敗,但是沒有

[英]behat fails with javascript but succeeds without

我正在使用Behat / Mink為我的php應用程序編寫驗收測試,發現了一件奇怪的事情:當JavaScript打開時,Behat找不到輸入字段,而當關閉JavaScript時,它找到相同的字段。

准確地說:以下情況

Scenario: adding article keywords, no javascript used
 Given I am on "articles/create"
 When I fill in "Articles[title]" with "About all properties"
...

通過完美。 但是,一旦我將標簽javascript添加到上述情況中

@javascript    
Scenario: adding article keywords
 Given I am on "articles/create"
 When I fill in "Articles[title]" with "About all properties"

它開始失敗:

When I fill in "Articles[title]" with "About all properties"
# FeatureContext::fillField()
Form field with id|name|label|value "Articles[title]" not found.

可能是什么原因?

@javascript將使用Selenium驅動程序運行您的功能,Selenium可能需要一些時間來加載頁面,您可以嘗試在“我在...上”之后添加一個步驟“我在等...”。 希望這只是DOM需要花費一些時間來加載。

@javascript    
Scenario: adding article keywords
 Given I am on "articles/create"
 Then I wait 1000
 When I fill in "Articles[title]" with "About all properties"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM