Appium Wait{condition}

I am using the wait method in one of my general steps, the code looks like this:

When(/^I am reading an article titled (.+)$/) do |article_title| wait{find(article_title).displayed?} find(article_title).click end

The purpose for doing so, is to make sure the app has completely loaded before “find(article_title).click” is ran, otherwise appium cannot find the element because it isn’t there.

The “wait{find(article_title).displayed?}” code results in a timeout error:

Selenium::WebDriver::Error::TimeOutError: timed out after 30 seconds (An element could not be located on the page using the given search parameters.)

Even though the element is present, and it is being displayed.

I am passing the correct article title in from my cucumber step, appium console returns the value when I run the page command, so it is there.