3
所以此代碼工作完全正常,直到我最近更新了我的硒的webdriver:如何從下拉列表中選擇第一個元素。回報率/水豚/硒
When /^I search for (.*)$/ do |term|
term = " " if term == "blank"
step "I fill in search with #{term}"
within(".navbar-search") do
page.find(:css, "li:first").click
end
end
我更新了,現在我得到以下錯誤:
An invalid or illegal string was specified (Selenium::WebDriver::Error::UnknownError)
./features/step_definitions/search_steps.rb:5:in `block (2 levels) in <top (required)>'
./features/step_definitions/search_steps.rb:4:in `/^I search for (.*)$/'
features/search_friend.feature:13:in `When I search for <term>'
這裏黃瓜功能:
@javascript
Scenario Outline: The search bar
Given I login
And I have a contact named ABC
And I have a contact named DEF
And I have a contact named GHI
When I search for <term>
Then I should see the message <message>
Examples:
| term | message |
| ... some examples ... | |
第一個選項沒有工作,第二個沒有。非常感謝你。 – wachichornia
@wachichornia我想第一個變體不起作用,因爲它不等待元素出現在頁面上。我的猜測是正確的嗎? –
它沒有找到它,這意味着它不會等待。你是對的。 – wachichornia