How to use wait until the page is loaded or element is displayed

I got this error:
Timed out after 2 seconds. Element not found
For documentation on this error, please visit:

My code snippets:
@Given("^(?:.*) is at the add new goal page$")
public void maryIsAtTheAddNewGoalPage() {

In my pageObjects class
public class GoalPage extends PageObject {

public GoalPage(WebDriver driver) {

@iOSXCUITFindBy(accessibility = "btnAddNewGoal")
@AndroidFindBy(accessibility = "btnAddNewGoal")
private WebElement addNewGoalButton;

public WebElement getAddButton()
return addButton;

how can I inspect the element is visible or the page is loaded?

No such element exception appears when that element that you are trying to interact is not there. maybe to put an explicit wait to wait visibility of element located is a good option. You can set the timeout for that wait as well.
sth like this :
WebDriverWait wait = new WebDriverWait(driver,15);