Advertisement
ajorpheus

Untitled

Sep 1st, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. at.findText({
  2. options: options2,
  3. matchMethod: text => text.toLowerCase() === 'blsadfasdfsadf', // REQUIRED, How to do matching to determine found.
  4. duration: '2s', // OPTIONAL, how long time you want it to keep finding? Three formats are supported: 1. `duration: 10` means repeat finding 10 times, the value must be a number, can't be a string; 2. `duration: '60s'` means keep finding for 60 seconds, the value must be seconds + a character 's'; 3. `duration: '2020-05-30 12:00:00'` means keep finding till 2020-05-30 12:00:00. Default is `duration: 10` means repeat 10 times, the value must be a string.
  5. interval: 1000, // OPTIONAL, interval between loops in milliseconds, default is 1000 milliseconds.
  6. exitIfFound: true, // OPTIONAL, if exit findText if got a result successfully, default is true.
  7. eachFindingCallback: () => { // OPTIONAL, will call this function after each finding loop.
  8. console.log(`------Did a time of finding text at ${new Date().toLocaleString()}-------`)
  9. },
  10. foundCallback: result => { // OPTIONAL, will call this function while getting matched result, returns the rectangle coordinate matching the action you specified through `matchMethod`.
  11. console.log(`Got result of findText:\n${JSON.stringify(result, null, ' ')}`)
  12. //alert(`Got result of findText:\n${JSON.stringify(result)}`)
  13. clickAtX=result[0].bottomLeft.x;
  14. clickAtY=result[0].bottomLeft.y;
  15. console.log(`Should click at : ${clickAtX}, ${clickAtY} `)
  16. tap(clickAtX, clickAtY)
  17. },
  18. errorCallback: error => { // OPTIONAL, handle any error, will exit findText if got error, if no errorCallback provide, it will alert while getting error.
  19. alert(error)
  20. },
  21. completedCallback: () => { // OPTIONAL, callback when all finding completed
  22. console.log('The results is :' + result)
  23. },
  24. block: true, // OPTIONAL, you want to run findColors asynchronously or synchronously, block=true means it will run synchronously and block here till completed, default is false, doesn't block here.
  25. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement