2 #ifndef _YI_WEBDRIVER_H_ 3 #define _YI_WEBDRIVER_H_ 16 class CYIAppiumTCPServer;
17 class CYIWebDriverPriv;
98 enum WEB_DRIVER_KEY_CODE
160 enum GET_NODE_STRATEGY
174 struct AttributeValue
182 etag(ATTRIBUTE_NONE),
189 struct SourceTreeFilter
202 static std::vector<std::unique_ptr<CYIKeyEvent>> CreateWebDriverKeyEvents(
const CYIString &keys);
207 static std::unique_ptr<CYIKeyEvent> CreateWebDriverKeyEvent(WEB_DRIVER_KEY_CODE eKey);
219 static std::unique_ptr<CYIKeyEvent> CreateNumpadKeyEvent(
YI_ASCII_CODE eKeyValue);
224 static std::unique_ptr<CYIKeyEvent> CreateSimpleKeyEvent(char32_t key);
230 LongPressGestureHandler();
231 void Start(uint64_t uDelayLength);
233 void SetDeltaCoords(
const glm::vec3 &deltaCoords);
234 void SetReleaseCoords(
const glm::vec3 &releaseCoords);
235 void SetDownCoords(
const glm::vec3 &DownCoords);
237 const glm::vec3 & GetDeltaCoords()
const;
238 const glm::vec3 & GetReleaseCoords()
const;
239 const glm::vec3 & GetDownCoords()
const;
245 glm::vec3 m_deltaCoords;
246 glm::vec3 m_releaseCoords;
247 glm::vec3 m_downCoords;
255 void ReceiveCommand(
const CYIString &strCommand);
256 void SendByteResponse(
const std::vector<uint8_t> byteData);
257 void SendStringResponse(
const CYIString &strData)
const;
259 void RetrieveScreenshot();
266 void GetWindowSize();
276 void RespondGetElementByStrategy(GET_NODE_STRATEGY eStrategy,
const std::vector<CYIString> &strategyArguments);
286 void RespondGetElementsByStrategy(GET_NODE_STRATEGY eStrategy,
const std::vector<CYIString> &strategyArguments);
291 std::list<CYISceneNode *> FindNodesByStrategy(GET_NODE_STRATEGY eStrategy,
const CYIString &strategyValue,
const CYIString &referenceAddress);
298 void RespondGetAttribute(
const std::vector<CYIString> &attributeArguments);
311 void ClickNode(
const std::vector<CYIString> &args);
318 void DoTap(
const std::vector<CYIString> &args,
bool bLongPress =
false);
326 void DoSwipe(
const std::vector<CYIString> &args,
bool bLongPress =
false);
331 void SetSourceTreeFilter(
const std::vector<CYIString> &args);
336 void SetTimeDilation(
const std::vector<CYIString> &args);
347 void ClearNode(
const std::vector<CYIString> &
354 void RespondGetText(
const std::vector<CYIString> &args);
369 void SendKeys(
const std::vector<CYIString> &args);
376 void RespondElementEnabled(
const std::vector<CYIString> &args);
389 bool IsElementFullyDisplayed(
const CYISceneNode *pNode)
const;
394 bool IsElementHittable(
const CYISceneNode *pNode)
const;
404 bool CoordinatesCanHitNode(
const CYISceneNode *pNode,
const glm::vec3 &coordinates)
const;
409 const glm::vec3 GetHitCoordinates(
const CYISceneNode *pNode)
const;
416 void RespondElementSelected(
const std::vector<CYIString> &args);
423 bool IsElementSelected(
const CYISceneNode *pNode)
const;
430 void RespondElementDisplayed(
const std::vector<CYIString> &args)
const;
439 bool IsElementDisplayed(
const CYISceneNode *pNode)
const;
444 bool IsElementOnScreen(
const CYISceneNode *pNode)
const;
451 void RetrieveNodeSize(
const std::vector<CYIString> &args)
const;
458 void RetrieveNodeLocation(
const std::vector<CYIString> &args)
const;
461 void SendSuccessResponse(yi::rapidjson::Document &responseObject)
const;
462 void SendSuccessResponse(
const CYIString &returnValue)
const;
463 void SendSuccessResponse(
bool returnValue)
const;
464 void SendSuccessResponse(
float returnValue)
const;
465 void SendSuccessResponse()
const;
471 std::list<CYISceneNode*> GetAllNodesWithStrategyValue(GET_NODE_STRATEGY eStrategy,
const CYIString &strategyValue);
476 std::list<CYISceneNode*> GetAllNodesWithStrategyValueFromParent(GET_NODE_STRATEGY eStrategy,
const CYIString &strategyValue,
CYISceneNode *pParentNode);
514 CYIAABB GetSurfaceScreenRect()
const;
538 void GetNodesFromChildren(
const CYISceneNode *pSceneNode,
const CYIString &propertyName,
const CYIString &propertyValue, std::list<CYISceneNode *> &list);
540 void SimulateClick(
const glm::vec3 &clickCoords,
bool bLongPress =
false);
541 void SimulateSwipe(
const glm::vec3 &downCoords,
const glm::vec3 &deltaCoords,
bool bLongPress =
false);
543 void OnLongPressUpTimeout();
544 void OnLongPressMoveTimeout();
546 void ActionUp(
const glm::vec3 &releaseCoords);
547 void ActionMove(
const glm::vec3 &releaseCoords);
549 CYIAppiumTCPServer *m_pServer;
550 LongPressGestureHandler m_longPressHandler;
551 SourceTreeFilter m_sourceTreeFilter;
Definition: YiWebDriver.h:81
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:114
const int32_t YI_LONG_PRESS_DELAY
Definition: YiSceneManager.h:42
Class for key events.
Definition: YiKeyEvent.h:15
Definition: YiWebDriver.h:86
Definition: YiEvent.h:338
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:35
Definition: YiWebDriver.h:78
YI_KEY_CODE
Key code for CYIKeyEvent events.
Definition: YiEvent.h:81
YI_ASCII_CODE
Ascii codes for key characters.
Definition: YiEvent.h:336
Definition: YiWebDriver.h:82
A low-precision timer driven by the update loop.
Definition: YiTimer.h:29
Definition: YiWebDriver.h:84
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:114
Definition: YiWebDriver.h:85
Definition: YiWebDriver.h:83
Definition: YiWebDriver.h:80
CYIWebDriver exposes functionality for the Appium driver to use, using a socket server.
Definition: YiWebDriver.h:28
RESPONSE_STATUS
Definition: YiWebDriver.h:75
Definition: YiSignalHandler.h:174
Definition: YiWebDriver.h:77
This class represents an Axis-Aligned Bounding Box.
Definition: YiAABB.h:24
Definition: YiWebDriver.h:79
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:164