Keyword-Assert


SUBMITTED BY: rilp44

DATE: Dec. 4, 2015, 12:06 p.m.

FORMAT: Text only

SIZE: 1.2 kB

HITS: 8291

  1. VERSION BUILD=10.4.28.1074
  2. TAB T=1
  3. TAB CLOSEALLOTHERS
  4. '
  5. 'Explain macro purpose:
  6. URL GOTO=http://demo.imacros.net/Automate/KeywordAssert
  7. WAIT SECONDS=3
  8. '
  9. 'Start Test
  10. URL GOTO=http://www.imacros.net/
  11. '
  12. 'Check for the keyword "iMacros" on the web page
  13. '
  14. 'For more details, please see the Wiki FAQ at
  15. 'http://wiki.imacros.net/Web_Testing#Q:_How_can_I_search_for_a_specific_keyword_on_a_web_page.3F
  16. '
  17. '
  18. 'Method 1
  19. '
  20. TAG POS=1 TYPE=SPAN ATTR=TXT:*iMacros*
  21. '
  22. 'Same as above, but this time ignore the formatting (TYPE=*)
  23. 'This command takes longer, as iMacros needs to scan the complete page, not only certain html tags
  24. TAG POS=1 TYPE=* ATTR=TXT:*iMacros*
  25. '
  26. 'Alternatively, you can "invert" the keyword search and generate an error
  27. '*IF*word is on found on the page
  28. TAG POS=1 TYPE=* ATTR=TXT:*404* CONTENT=EVENT:FAIL_IF_FOUND
  29. '
  30. '
  31. 'Method 2
  32. '
  33. 'The result of the EXTRACT command can be retrieved
  34. 'with extracted_text = iim1.iimGetLastExtract()
  35. '
  36. TAG POS=1 TYPE=SPAN ATTR=TXT:*iMacros* EXTRACT=TXT
  37. '
  38. '
  39. 'If the macro reaches this point, ALL assert tests have been passed!
  40. URL GOTO=http://demo.imacros.net/Automate/KeywordAssertOK

comments powered by Disqus