Demo-Keyword-Assert

From iMacros
Jump to: navigation, search

This macro navigates to the iMacros demos homepage and asserts that the keyword "iMacros" appears on the page. It also checks that the Macros logo test appears on the page. After that it navigates to an "Ok" page.

The macro will stop if any of the assertions fails.


 VERSION BUILD=10.4.28.1074     
 TAB T=1
 TAB CLOSEALLOTHERS
 '     
 'Explain macro purpose:
 URL GOTO=http://demo.imacros.net/Automate/KeywordAssert
 WAIT SECONDS=3
 '
 'Start Test
 URL GOTO=http://www.imacros.net/
 '
 'Check for the keyword "iMacros" on the web page
 '
 'For more details, please see the Wiki FAQ at 
 'http://wiki.imacros.net/Web_Testing#Q:_How_can_I_search_for_a_specific_keyword_on_a_web_page.3F
 '
 '
 'Method 1
 ' 
 TAG POS=1 TYPE=SPAN ATTR=TXT:*iMacros*
 '
 'Same as above, but this time ignore the formatting (TYPE=*)
 'This command takes longer, as iMacros needs to scan the complete page, not only certain html tags
 TAG POS=1 TYPE=* ATTR=TXT:*iMacros*
 '
 'Alternatively, you can "invert" the keyword search and generate an error
 '*IF*word is on found on the page
 TAG POS=1 TYPE=* ATTR=TXT:*404* CONTENT=EVENT:FAIL_IF_FOUND 
 '
 '
 'Method 2 
 '
 'The result of the EXTRACT command can be retrieved 
 'with extracted_text = iim1.iimGetLastExtract() 
 '
 TAG POS=1 TYPE=SPAN ATTR=TXT:*iMacros* EXTRACT=TXT
 '
 '
 'If the macro reaches this point, ALL assert tests have been passed!
 URL GOTO=http://demo.imacros.net/Automate/KeywordAssertOK


To read more about keyword assertions please see:

FAQ: Q: How can I search for a specific keyword on a web page?

FAQ: I want to test that certain images will show up on my site when a page is loaded.

FAQ: Does iMacros support multiple checkpoints in one macro?

Testing AJAX websites

iMacros Reporting Options