# urlが変更されるまで待つ
# 登録ボタンをクリックして登録処理が完了すると画面遷移する場合などで画面遷移するまで待つようにできる
# 例) wait_for_url_change { click_on '登録' }
# 登録して画面遷移が終わるまでwait_for_url_changeでsleepされる
def wait_for_url_change(timeout_sec = 3)
current_path = page.current_path
yield
Timeout.timeout(timeout_sec) do
until page.current_path == current_path
sleep(0.1)
end
end
end
Created
July 28, 2015 07:19
-
-
Save bluerabbit/2b9d189cd67626c876fc to your computer and use it in GitHub Desktop.
capybaraでURLが変更されるまで待つhelper method
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment