Conditional step based on active URL

2 posts, 1 answers
  1. Alex
    Alex avatar
    5 posts
    Member since:
    Jun 2015

    Posted 31 Aug 2015 Link to this post

    Hi,

    I would like to use conditional step (using if...else) based on active URL.

    For example, if after performing some action i am navigated to specific url - additional step will be executed. If browser url does not contains some value (or not equal to given url) - do nothing, just continue the regular test flow.

    I can add the coded step to verify the URL, but i'm not able to use the bool value from it into 'If' condition. Any workaround ideas?

    Something like this:

    string Url = ActiveBrowser.Url;
    bool is​PageOpened;
    is​PageOpened = Url.Contains("Start.aspx");​

     

    Thanks in advance.

  2. Answer
    Cody
    Admin
    Cody avatar
    3360 posts

    Posted 31 Aug 2015 Link to this post

    Hello Alex,

    I am sorry but our IF/ELSE block will not accept a URL condition or bool value as the condition to test. It can only use some property of an existing UI element, such as value or visibility, or the presence/absence of a specific element for the condition.

    What you're after, do something only if the URL contains some string, can only be done in a coded step.

    Regards,
    Cody
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top