13 November, 2014

How to know in which iframe we are or whether the element is present in the source code or not?

Its very hard specially when we have nested iframes to know in which iframe we are currently working.
also the situation comes when we want to know whether the element is present in the source code we are currently pointing to.

By using Assertion we can easily know it.

Also remember if the Assertions fails the script will Stop and will not execute the steps after assertions.

  assertTrue(driver.getPageSource().contains("Text-you-are-Looking-for"));  


2 comments:

  1. What is CWidgetButton ?

    ReplyDelete
    Replies
    1. It can be any string which you are looking for in the desired iframe

      Delete