-
Notifications
You must be signed in to change notification settings - Fork 281
Mobile automation
ExtendedWebElement Mobile Configuration
### **Mobile Configuration**All project configuration properties are located in _config.properties file. In the table below we are providing description for the mobile project parametrs (you may see most of main parametrs here):
Attribute | Meaning | Default value | Example |
---|---|---|---|
driver_type | Type of driver which is needed for automation | {must_override} | mobile |
mobile_device_name | Device name for report | {must_override} | Sumsung_Galaxy_J5 |
mobile_device_type | Type of device | {must_override} | phone |
mobile_devices | Information about using device, divided by ";" for different devices and "|" for different parametrs | {must_override} | ;Sumsung J5|phone|ANDROID |5.1|759b543c |http://localhost:4723/wd/hub |
mobile_platform_name | Name of using mobile platform | {must_override} | Android/iOS |
mobile_platform_version | Version of mobile platform | {must_override} | 6.0.1 |
mobile_automation_name | Name of programm using for automation | {must_override} | Appium |
mobile_app | Path application which is tested, should be the same as in Appium settings | {must_override} | D:/application.apk |
mobile_app | New implicit timeout in seconds to wait for element for mobile automation | 120 | 180 |
mobile_device_udid | Unique Device ID | {must_override} | 759b543c |
- For Android:
#=============== Android Mobile ======================#
mobile_devices=;Sumsung Galaxy J5|phone|ANDROID|5.1|192.168.56.101:5555|http://localhost:4723/wd/hub
mobile_device_type=phone
mobile_device_name=Sumsung Galaxy J5
mobile_platform_name=Android
mobile_platform_version=5.1.1
mobile_browser_name=NULL
mobile_automation_name=Appium
mobile_app=D:/application1.apk
mobile_new_command_timeout=180
mobile_device_udid=759b543c
#=====================================================#
- For iOS:
#=================== iOS Mobile ======================#
mobile_devices=;iPhone 6|phone|iOS|9.3||http://0.0.0.0:4723/wd/hub
mobile_device_name=iPhone 6
mobile_platform_name=iOS
mobile_platform_version=9.3
#mobile_automation_name=Appium
mobile_app=/Users/administrator/Downloads/Record.app
mobile_new_command_timeout=180
mobile_device_udid=4addd1a575612c6036012dc9f83b925aa11e115a
#=====================================================#
ExtendedWebElement
How to find ExtendedWebElement?
ExtededWebElement's methods
ExtendedWebElement is an extended version of selenium WebElement which you can find in org.openqa.selenium package. The best thing in using ExtendedWebElement is that you can use both all old methods of WebElement and new more comfortable Carina methods.
### **How to find ExtendedWebElement?**The simpliest way to find ExtendedWebElement is using annotation @FindBy. The @FindBy annotation is used to locate one or more ExtendedWebElements using a single criterion. The list of criterions is standart:
- className
- css
- how...using
- id
- linkText
- name
- partialLinkText
- tagName
- xpath
Example:
@FindBy(name = "Hybrid")
private ExtendedWebElement hybridUnits;
@FindBy(id = "com.ua.record.debug:id/spinner_text")
private List <ExtendedWebElement> unitsVersions;
Method | Return type | Description |
---|---|---|
getName() | String | Get the name of this element |
getText() | String | Get the visible innerText of this element |
getAttribute() | String | Get the value of a the given attribute of this element |
click() | void | Click on element |
doubleClick() | void | Double click on element |
isElementPresent() | boolean | Is element present or not? |
isElementPresent(long timeout) | boolean | Is element present or not during the timeout in seconds? |
isElementNotPresent(long timeout) | boolean | Is element not present during the timeout in seconds? |
isElementWithTextPresent(String text) | boolean | Is element with text present or not? |
isElementWithTextPresent(String text, long timeout) | boolean | Is element with text present or not during the timeout in seconds? |
clickIfPresent | boolean | Click on element if it's presented, return true if click is performed |
type(String text) | void | Clear the value of field and simulate typing the text |
scrollTo() | void | Scroll page until the element could be located |
check() | void | If element is checkable it will be checked |
uncheck() | void | If element is checkable it will be unchecked |
isCheck() | boolean | If element is checkable return is the element checked or not |
tapWithCoordinates(double x, double y) | void | Tap on screen using the given cordinates |
You can simple transform ExtendedWebElement to WebElement using getElement() method. After this it's possible to operate with standart WebElement methods.
Example:
Point point = element.getElement().getLocation();
Dimension dim = element.getElement().getSize();