public class MacacaClient
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MacacaClient.GesturePinchType |
| Modifier and Type | Field and Description |
|---|---|
MacacaDriver |
contexts |
Element |
element |
int |
waitElementTimeInterval
time interval between finding an element ,valid for waitForElement() function
paired with waitElementTimeout, if waitElementTimeout = 1000 & waitElementTimeInterval = 200,it means we will find given element per 200ms,until 1000ms passed,
which means we will find for 5 times
|
int |
waitElementTimeout
timeout for finding an element ,valid for waitForElement() function
paired with waitElementTimeInterval, if waitElementTimeout = 1000 & waitElementTimeInterval = 200,it means we will find given element per 200ms,until 1000ms passed,
which means we will find for 5 times
|
| Constructor and Description |
|---|
MacacaClient() |
| Modifier and Type | Method and Description |
|---|---|
MacacaClient |
acceptAlert()
Accepts the currently displayed alert dialog.
Support: Android iOS |
MacacaClient |
alertKeys(java.lang.String keys)
Sends keystrokes to a JavaScript prompt() dialog.
Support: iOS |
java.lang.String |
alertText()
Gets the text of the currently displayed JavaScript alert(), confirm(),
or prompt() dialog.
Support: iOS |
java.lang.String |
allCookies()
Returns all cookies associated with the address of the current browsing context’s active document.
|
MacacaClient |
back()
press back.
Support: Android Web(WebView) |
MacacaClient |
clear()
Deprecated.
|
MacacaClient |
click()
Deprecated.
|
MacacaClient |
context(java.lang.String contextRef)
Set the current context.
Support: Android iOS |
JSONArray |
contexts()
Get a list of the available contexts.
Support: Android iOS |
int |
countOfElements(GetElementWay wayToFind,
java.lang.String value)
get count of elements when there exist multiple elements
Support: Android iOS Web(WebView) |
java.lang.String |
currentContext()
Get the current context.
Support: Android iOS |
void |
deleteAllCookies()
Allows deletion of all cookies associated with the active document’s address.
|
void |
deleteCookie(java.lang.String cookieName)
Delete either a single cookie by parameter name, or all the cookies associated with the active document’s address if name is undefined.
|
MacacaClient |
dismissAlert()
Dismisses the currently displayed alert dialog.
Support: Android iOS |
void |
doubleTap(double x,
double y)
double tap by coordinate
Support: Android iOS
|
void |
drag(double fromX,
double fromY,
double toX,
double toY,
double duration)
drag
Support: Android iOS
|
Element |
element(java.lang.String name,
java.lang.String value)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
elementByClassName()
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
elementByClassName(java.lang.String className)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
elementByCss(java.lang.String selector)
Search for an element on the page, starting from the document root.
Support: Web(WebView) |
Element |
elementById(java.lang.String elementId)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
elementByLinkText(java.lang.String linkText)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
elementByName(java.lang.String name)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
elementByPartialLinkText(java.lang.String partialLinkText)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
elementByTagName(java.lang.String tagName)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
elementByXPath(java.lang.String xpath)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
java.util.List<Element> |
elementsByClassName(java.lang.String className)
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView) |
java.util.List<Element> |
elementsByCss(java.lang.String css)
Search for multiple elements on the page, starting from the document
root.
Support: Web(WebView) |
java.util.List<Element> |
elementsById(java.lang.String elementId)
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView) |
java.util.List<Element> |
elementsByLinkText(java.lang.String linkText)
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView) |
java.util.List<Element> |
elementsByName(java.lang.String name)
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView) |
java.util.List<Element> |
elementsByPartialLinkText(java.lang.String partialLinkText)
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView) |
java.util.List<Element> |
elementsByTagName(java.lang.String tagName)
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView) |
java.util.List<Element> |
elementsByXPath(java.lang.String xpath)
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView) |
JSONObject |
execute(java.lang.String code)
Inject a snippet of JavaScript into the page for execution in the context
of the currently selected frame.
Support: Web(WebView) |
void |
forward()
Navigate forwards in the browser history, if possible.
|
MacacaClient |
frame(java.lang.String locator) |
MacacaClient |
get(java.lang.String tmpUrl)
Navigate to a new URL.
Support: Web(WebView) |
Element |
getElement(GetElementWay wayToFind,
java.lang.String value)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
getElement(GetElementWay wayToFind,
java.lang.String value,
int index)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
java.lang.Object |
getProperty(java.lang.String name)
Deprecated.
|
java.lang.Object |
getRect()
Deprecated.
|
int |
getWaitElementTimeInterval() |
int |
getWaitElementTimeout() |
JSONObject |
getWindowSize()
Get the size of the specified window.
Support: Android iOS Web(WebView) |
MacacaClient |
initDriver(JSONObject jsonObject)
Initial webdriver client and create a session.
Support: Android iOS Web(WebView) |
boolean |
isElementExist(GetElementWay wayToFind,
java.lang.String value)
check if target element exist
Support: Android iOS Web(WebView) |
boolean |
isElementExist(GetElementWay wayToFind,
java.lang.String value,
int index)
check if target element exist
Support: Android iOS Web(WebView) |
boolean |
isElementExist(java.lang.String using,
java.lang.String value)
check if target element exist
Support: Android iOS Web(WebView) |
MacacaClient |
keys(java.lang.String tmpkeys)
Send a sequence of key strokes to the active window.
Support: Android iOS Web(Webview) |
MacacaClient |
maximize()
set maximize size of the window.
Support: Web(WebView) |
void |
pinch(double x,
double y,
double scale,
double velocity,
MacacaClient.GesturePinchType direction,
double percent,
int steps)
pinch
Support: Android iOS
|
void |
press(double x,
double y,
double duration)
long press
Support: Android iOS
|
void |
quit()
Delete session.
Support: Android iOS Web(WebView) |
void |
rotate(double rotation,
double velocity)
rotate
Support: iOS
|
MacacaClient |
saveScreenshot(java.lang.String fileName)
Save screenshot of the current page.
Support: Android iOS Web(WebView) |
MacacaClient |
sendKeys(java.lang.String keys)
Deprecated.
|
java.lang.String |
sessionId()
Get the current sessionId.
Support: Android iOS Web(WebView) |
void |
setCookie(JSONObject jsonObject)
Adds a single cookie to the cookie store associated with the active document’s address.
|
void |
setWaitElementTimeInterval(int waitElementTimeInterval) |
void |
setWaitElementTimeout(int waitElementTimeout) |
MacacaClient |
setWindowSize(int width,
int height)
Change the size of the specified window.
Support: Web(WebView) |
MacacaClient |
sleep(int ms)
Set the amount of time the driver should wait.
Support: Android iOS Web(WebView) |
java.lang.String |
source()
Get the current page source.
Support: Android iOS Web(WebView) |
java.lang.String |
status()
Query the server's current status.
Support: Android iOS Web(WebView) |
MacacaClient |
takeScreenshot()
Take a screenshot of the current page.
Support: Android iOS Web(WebView) |
void |
tap(double x,
double y)
tap by coordinate
Support: Android iOS
|
java.lang.String |
text()
Deprecated.
|
java.lang.String |
title()
Get the current page title.
Support: Web(WebView) |
MacacaClient |
touch(java.lang.String action,
JSONObject args)
Apply touch actions on devices.
|
java.lang.String |
url()
Retrieve the URL of the current page.
Support: Web(WebView) |
Element |
waitForElement(GetElementWay wayToFind,
java.lang.String value)
find target element,if it doesn't exist,keep finding during given time
(property:waitElementTimeout)
Support: Android iOS Web(WebView) |
Element |
waitForElement(GetElementWay wayToFind,
java.lang.String value,
int index)
find target element,if it doesn't exist,keep finding during given time
(property:waitElementTimeout)
Support: Android iOS Web(WebView) |
Element |
waitForElement(java.lang.String using,
java.lang.String value)
Search for element at specific interval during given time
Support: Android iOS Web(WebView) |
Element |
waitForElement(java.lang.String using,
java.lang.String value,
int timeout,
int interval)
Search for element at specific interval during given time
Support: Android iOS Web(WebView) |
Element |
waitForElementByCss(java.lang.String selector)
Search for an element on the page, starting from the document root.
Support: Web(WebView) |
Element |
waitForElementById(java.lang.String elementId)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
waitForElementByLinkText(java.lang.String text)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
waitForElementByName(java.lang.String name)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
waitForElementByPartialLinkText(java.lang.String text)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
waitForElementByTagName(java.lang.String tagname)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
Element |
waitForElementByXPath(java.lang.String xpath)
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView) |
public MacacaDriver contexts
public Element element
public int waitElementTimeout
public int waitElementTimeInterval
public int getWaitElementTimeout()
public void setWaitElementTimeout(int waitElementTimeout)
public int getWaitElementTimeInterval()
public void setWaitElementTimeInterval(int waitElementTimeInterval)
public MacacaClient acceptAlert() throws java.lang.Exception
Accepts the currently displayed alert dialog.
Support: Android iOS
java.lang.Exceptionpublic MacacaClient dismissAlert() throws java.lang.Exception
Dismisses the currently displayed alert dialog.
Support: Android iOS
java.lang.Exceptionpublic java.lang.String alertText()
throws java.lang.Exception
Gets the text of the currently displayed JavaScript alert(), confirm(),
or prompt() dialog.
Support: iOS
java.lang.Exceptionpublic MacacaClient alertKeys(java.lang.String keys) throws java.lang.Exception
Sends keystrokes to a JavaScript prompt() dialog.
Support: iOS
keys - Keystrokes to send to the prompt() dialog.java.lang.Exceptionpublic JSONArray contexts()
throws java.lang.Exception
Get a list of the available contexts.
Support: Android iOS
java.lang.Exceptionpublic MacacaClient context(java.lang.String contextRef) throws java.lang.Exception
Set the current context.
Support: Android iOS
contextRef - context reference from contextsjava.lang.Exceptionpublic java.lang.String currentContext()
throws java.lang.Exception
Get the current context.
Support: Android iOS
java.lang.Exceptionpublic Element element(java.lang.String name, java.lang.String value) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
name - The name attribute of elementvalue - the value for target elementjava.lang.Exceptionpublic Element elementById(java.lang.String elementId) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
elementId - The ID attribute of elementjava.lang.Exceptionpublic Element elementByCss(java.lang.String selector) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Web(WebView)
selector - The css selector of elementjava.lang.Exceptionpublic Element elementByXPath(java.lang.String xpath) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
xpath - The XPath expression of elementjava.lang.Exceptionpublic Element elementByName(java.lang.String name) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
name - The name attribute of elementjava.lang.Exceptionpublic Element getElement(GetElementWay wayToFind, java.lang.String value, int index) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
wayToFind - way to find an elementvalue - target value for element,paired with wayToFindindex - index for target elementjava.lang.Exceptionpublic Element getElement(GetElementWay wayToFind, java.lang.String value) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
wayToFind - the way to find an element,for example:ID,CSS,XPATH...value - the value for target element,paired with wayToFindjava.lang.Exceptionpublic int countOfElements(GetElementWay wayToFind, java.lang.String value) throws java.lang.Exception
get count of elements when there exist multiple elements
Support: Android iOS Web(WebView)
wayToFind - the way to find an element,for example:ID,CSS,XPATH...value - the value for target element,paired with wayToFindjava.lang.Exceptionpublic Element waitForElement(GetElementWay wayToFind, java.lang.String value, int index) throws java.lang.Exception
find target element,if it doesn't exist,keep finding during given time
(property:waitElementTimeout)
Support: Android iOS Web(WebView)
wayToFind - the way to find an element,for example:ID,CSS,XPATH...value - the value for target element,paired with wayToFindindex - the index for target elementjava.lang.Exceptionpublic Element waitForElement(GetElementWay wayToFind, java.lang.String value) throws java.lang.Exception
find target element,if it doesn't exist,keep finding during given time
(property:waitElementTimeout)
Support: Android iOS Web(WebView)
wayToFind - the way to find an element,for example:ID,CSS,XPATH...value - the value for target element,paired with wayToFindjava.lang.Exceptionpublic Element elementByClassName() throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
java.lang.Exceptionpublic Element elementByClassName(java.lang.String className) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
className - The className attribute of elementjava.lang.Exceptionpublic Element elementByLinkText(java.lang.String linkText) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
linkText - The linkText attribute of elementjava.lang.Exceptionpublic Element elementByTagName(java.lang.String tagName) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
tagName - The tag name attribute of elementjava.lang.Exceptionpublic Element elementByPartialLinkText(java.lang.String partialLinkText) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
partialLinkText - The partial link text attribute of elementjava.lang.Exceptionpublic java.util.List<Element> elementsByXPath(java.lang.String xpath) throws java.lang.Exception
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView)
xpath - The XPath expression of elementsjava.lang.Exceptionpublic java.util.List<Element> elementsByName(java.lang.String name) throws java.lang.Exception
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView)
name - The name attribute of elementsjava.lang.Exceptionpublic java.util.List<Element> elementsById(java.lang.String elementId) throws java.lang.Exception
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView)
elementId - The elementId attribute of elementsjava.lang.Exceptionpublic java.util.List<Element> elementsByClassName(java.lang.String className) throws java.lang.Exception
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView)
className - The className attribute of elementsjava.lang.Exceptionpublic java.util.List<Element> elementsByCss(java.lang.String css) throws java.lang.Exception
Search for multiple elements on the page, starting from the document
root.
Support: Web(WebView)
css - The selector selector of elementsjava.lang.Exceptionpublic java.util.List<Element> elementsByLinkText(java.lang.String linkText) throws java.lang.Exception
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView)
linkText - The link text attribute of elementsjava.lang.Exceptionpublic java.util.List<Element> elementsByPartialLinkText(java.lang.String partialLinkText) throws java.lang.Exception
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView)
partialLinkText - The partial link text attribute of elementsjava.lang.Exceptionpublic java.util.List<Element> elementsByTagName(java.lang.String tagName) throws java.lang.Exception
Search for multiple elements on the page, starting from the document
root.
Support: Android iOS Web(WebView)
tagName - The tag name attribute of elementsjava.lang.Exceptionpublic Element waitForElement(java.lang.String using, java.lang.String value, int timeout, int interval) throws java.lang.Exception
Search for element at specific interval during given time
Support: Android iOS Web(WebView)
using - The way for find an element,eg:"name","xpath","css","id"value - The value for the specific waytimeout - Total time for searchinginterval - Time interval between searchingjava.lang.Exceptionpublic Element waitForElement(java.lang.String using, java.lang.String value) throws java.lang.Exception
Search for element at specific interval during given time
Support: Android iOS Web(WebView)
using - The way for find an element,eg:"name","xpath","css","id"value - The value for the specific wayjava.lang.Exceptionpublic Element waitForElementById(java.lang.String elementId) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
elementId - The ID attribute of elementjava.lang.Exceptionpublic Element waitForElementByCss(java.lang.String selector) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Web(WebView)
selector - The css selector of elementjava.lang.Exceptionpublic Element waitForElementByXPath(java.lang.String xpath) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
xpath - The XPath expression of elementjava.lang.Exceptionpublic Element waitForElementByTagName(java.lang.String tagname) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
tagname - The tagname expression of elementjava.lang.Exceptionpublic Element waitForElementByName(java.lang.String name) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
name - The name attribute of elementjava.lang.Exceptionpublic Element waitForElementByLinkText(java.lang.String text) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
text - The visible text of elementjava.lang.Exceptionpublic Element waitForElementByPartialLinkText(java.lang.String text) throws java.lang.Exception
Search for an element on the page, starting from the document root.
Support: Android iOS Web(WebView)
text - The visible text of elementjava.lang.Exceptionpublic boolean isElementExist(java.lang.String using,
java.lang.String value)
throws java.lang.Exception
check if target element exist
Support: Android iOS Web(WebView)
using - The way for find an element,eg:"name","xpath","css","id"value - The value for the specific wayjava.lang.Exceptionpublic boolean isElementExist(GetElementWay wayToFind, java.lang.String value, int index) throws java.lang.Exception
check if target element exist
Support: Android iOS Web(WebView)
wayToFind - The way to find an elementvalue - The value for the specific wayindex - The index of the target elementjava.lang.Exceptionpublic boolean isElementExist(GetElementWay wayToFind, java.lang.String value) throws java.lang.Exception
check if target element exist
Support: Android iOS Web(WebView)
wayToFind - The way to find an elementvalue - The value for the specific wayjava.lang.Exception@Deprecated public MacacaClient sendKeys(java.lang.String keys) throws java.lang.Exception
Send a sequence of key strokes to the active element.
Support: Android iOS Web(WebView)
keys - The keys sequence to be sent.java.lang.Exception@Deprecated public MacacaClient click() throws java.lang.Exception
Click on an element.
Support: Android iOS Web(WebView)
java.lang.Exception@Deprecated public MacacaClient clear() throws java.lang.Exception
clear on an element.
Support: Android iOS Web(WebView)
java.lang.Exceptionpublic MacacaClient back() throws java.lang.Exception
press back.
Support: Android Web(WebView)
java.lang.Exception@Deprecated
public java.lang.Object getProperty(java.lang.String name)
throws java.lang.Exception
Get the result of a property of a element.
Support: Android iOS Web(WebView). iOS: 'isVisible', 'label', 'value', Android: 'selected', 'description', 'text'
name - The property name of elementjava.lang.Exception@Deprecated
public java.lang.Object getRect()
throws java.lang.Exception
Get the dimensions and coordinates of the given element with a object including x/y/height/width.
Support: Android iOS
java.lang.Exceptionpublic JSONObject execute(java.lang.String code)
throws java.lang.Exception
Inject a snippet of JavaScript into the page for execution in the context
of the currently selected frame.
Support: Web(WebView)
code - The script to executejava.lang.Exceptionpublic MacacaClient keys(java.lang.String tmpkeys) throws java.lang.Exception
Send a sequence of key strokes to the active window.
Support: Android iOS Web(Webview)
tmpkeys - The keys sequence to be sent.java.lang.Exceptionpublic MacacaClient takeScreenshot() throws java.lang.Exception
Take a screenshot of the current page.
Support: Android iOS Web(WebView)
java.lang.Exceptionpublic MacacaClient saveScreenshot(java.lang.String fileName) throws java.lang.Exception
Save screenshot of the current page.
Support: Android iOS Web(WebView)
fileName - The absolute path of the image filenamejava.lang.Exceptionpublic MacacaClient initDriver(JSONObject jsonObject) throws java.lang.Exception
Initial webdriver client and create a session.
Support: Android iOS Web(WebView)
jsonObject - The capabilities of session more paramsjava.lang.Exceptionpublic java.lang.String sessionId()
throws java.lang.Exception
Get the current sessionId.
Support: Android iOS Web(WebView)
java.lang.Exceptionpublic void quit()
throws java.lang.Exception
Delete session.
Support: Android iOS Web(WebView)
java.lang.Exceptionpublic java.lang.String source()
throws java.lang.Exception
Get the current page source.
Support: Android iOS Web(WebView)
java.lang.Exceptionpublic java.lang.String status()
throws java.lang.Exception
Query the server's current status.
Support: Android iOS Web(WebView)
java.lang.Exceptionpublic MacacaClient sleep(int ms) throws java.lang.Exception
Set the amount of time the driver should wait.
Support: Android iOS Web(WebView)
ms - The amount of sleep time, in milliseconds. This value has a
lower bound of 0.java.lang.Exceptionpublic java.lang.String title()
throws java.lang.Exception
Get the current page title.
Support: Web(WebView)
java.lang.Exceptionpublic java.lang.String url()
throws java.lang.Exception
Retrieve the URL of the current page.
Support: Web(WebView)
java.lang.Exceptionpublic MacacaClient get(java.lang.String tmpUrl) throws java.lang.Exception
Navigate to a new URL.
Support: Web(WebView)
tmpUrl - java.lang.Exceptionpublic JSONObject getWindowSize()
throws java.lang.Exception
Get the size of the specified window.
Support: Android iOS Web(WebView)
java.lang.Exceptionpublic MacacaClient setWindowSize(int width, int height) throws java.lang.Exception
Change the size of the specified window.
Support: Web(WebView)
width - The new window width.height - The new window height.java.lang.Exceptionpublic MacacaClient maximize() throws java.lang.Exception
set maximize size of the window.
Support: Web(WebView)
java.lang.Exceptionpublic MacacaClient frame(java.lang.String locator) throws java.lang.Exception
locator - id, name, or xpathjava.lang.Exception@Deprecated
public java.lang.String text()
throws java.lang.Exception
Get text of the element
Support: Android iOS Web(WebView)
java.lang.Exceptionpublic MacacaClient touch(java.lang.String action, JSONObject args) throws java.lang.Exception
Apply touch actions on devices.
Support: Support: Android iOS
action - touch actions, such as, tap/doubleTap/press/pinch/rotate/drag , if you want to operate specific action,there is the same name API in this doc,like tap(x,y)args - Parameters of the action:https://github.com/alibaba/macaca/issues/366java.lang.Exceptionpublic void tap(double x,
double y)
throws java.lang.Exception
x - coordinate - xy - coordinate - yjava.lang.Exceptionpublic void doubleTap(double x,
double y)
throws java.lang.Exception
x - coordinate - xy - coordinate - yjava.lang.Exceptionpublic void press(double x,
double y,
double duration)
throws java.lang.Exception
x - coordinate - xy - coordinate - yduration - time to press(valid for iOS and Android,time-unit:s)java.lang.Exceptionpublic void pinch(double x,
double y,
double scale,
double velocity,
MacacaClient.GesturePinchType direction,
double percent,
int steps)
throws java.lang.Exception
x - coordinate -xy - coordinate -yscale - valid for iOS, GesturePinchType.PINCH_IN: scale < 1;GesturePinchType.PINCH_OUT:scale > 1velocity - valid for iOSdirection - GesturePinchType.PINCH_IN,GesturePinchType.PINCH_OUTpercent - valid for Android, percent to pinchsteps - valid for Android, unit for andriod pinchjava.lang.Exceptionpublic void rotate(double rotation,
double velocity)
throws java.lang.Exception
rotation - 旋转弧度velocity - 旋转速率java.lang.Exceptionpublic void drag(double fromX,
double fromY,
double toX,
double toY,
double duration)
throws java.lang.Exception
fromX - drag start x-coordinatefromY - drag start y-coordinatetoX - drag end x-coordinatetoY - drag end y-coordinateduration - drag duration (valid for iOS and Android,time-unit:s)java.lang.Exceptionpublic java.lang.String allCookies()
throws java.lang.Exception
java.lang.Exceptionpublic void setCookie(JSONObject jsonObject)
throws java.lang.Exception
jsonObject - java.lang.Exceptionpublic void deleteCookie(java.lang.String cookieName)
throws java.lang.Exception
cookieName - cookie name to deletejava.lang.Exceptionpublic void deleteAllCookies()
throws java.lang.Exception
java.lang.Exceptionpublic void forward()
throws java.lang.Exception
java.lang.Exception