Posted

Reading Time: 1 minute

Using the Overview, Home and Back native buttons is pretty straight forward using WebDriver and Appium. Below there are the code examples for all the 3 buttons:

 

How to click the Back Button on Android with Selenium WebDriver and Appium


public void clickBackButton(){
((AndroidDriver)driver).pressKeyCode(AndroidKeyCode.BACK);
}

How to click the Overview Button on Android with Selenium WebDriver and Appium

See more details






public void clickOverviewButton(){
((AndroidDriver<WebElement>)driver).pressKeyCode(AndroidKeyCode.KEYCODE_APP_SWITCH);
}

How to click the Home Button on Android with Selenium WebDriver and Appium


public void clickHomeButton(){
((AndroidDriver<WebElement>)driver).pressKeyCode(AndroidKeyCode.HOME);
}

 


LoadFocus.com is a cloud testing platform:





Thanks for reading. I hope you learned something interesting about React!
If you found this article useful, please share it with others. Don’t forget to subscribe to get notified for the upcoming articles.