Text Box, Check Boxes & Radio Buttons
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
public class Example9CheckboxRadioButtonTextField {
public static void main(String[] args) throws MalformedURLException {
DesiredCapabilities dc= new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.1");//Version is number here
dc.setCapability(MobileCapabilityType.DEVICE_NAME, "Android");
dc.setCapability(MobileCapabilityType.APP, "C:\\apkfiles\\ApiDemos.apk");
URL url =new URL("http://127.0.0.1:4723/wd/hub");
AndroidDriver
//Views
driver.findElementsById("android:id/text1").get(10).click(); //views options
//Controls
driver.findElementsById("android:id/text1").get(4).click(); //controls
//Dark theme
//driver.findElementsById("android:id/text1").get(1).click();//dark theme OR
driver.findElementByAccessibilityId("2. Dark Theme").click(); //dark theme
//text box
driver.findElementById("io.appium.android.apis:id/edit").sendKeys("Pavan");
//checkbox1
driver.findElementById("io.appium.android.apis:id/check1").click();
//Radio button 1
driver.findElementById("io.appium.android.apis:id/radio1").click();
}
}