Telerik testing Framework - Anchor Click method not working with IE

9 posts, 1 answers
  1. Julio
    Julio avatar
    6 posts
    Member since:
    Aug 2012

    Posted 21 Sep 2012 Link to this post

    Hi Guys

    I'm using the Telerik Testing Framework (C#) and implementing the Telerik libraries, but there is a problem executing the Click method of an Anchor that is inside of a Span, this problem only presents with IE browser, instead of Click i need to do a MouseClick action.

    This behavior only presents over one specific object of the application tested, in other anchor I don't have to deal with that problem, also noticed that with Firefox and Chrome the Click method works perfectly okay.

    MouseClick works but is not the ideal way because we have a dependency of the mouse action and the focus/display on the application, I mean MouseClick don't work for Continuous Integration

     

     

    if (myManager.ActiveBrowser.BrowserType != BrowserType.InternetExplorer)

     

    {

     

     

        myManager.ActiveBrowser.Find.ByExpression<HtmlAnchor>("href=#", "innerText=" + GetLangInfo("Name")).Click();

     

    }

     

     

    else

     

     

     

        myManager.ActiveBrowser.Find.ByExpression<HtmlAnchor>("href=#", "innerText=" + GetLangInfo("Name")).MouseClick();

     



    Any help would be really appreciated

    Julio Cesar
  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 24 Sep 2012 Link to this post

    Hi Julio,

    I cannot determine why the .Click in IE isn't working as expected. I need to be able to reproduce the problem on my local machine so I investigate what is going on.

    Here's another approach you could consider taking: since a click on a hyperlink generally causes the browser to navigate to a different URL, you could replace the click with:
    myManager.ActiveBrowser.NavigateTo("new URL here");

    This should work in all browsers and bypass the extra click.

    Regards,
    Cody
    the Telerik team
    Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
    Vote now
  3. Julio
    Julio avatar
    6 posts
    Member since:
    Aug 2012

    Posted 28 Sep 2012 Link to this post

    Thanks Cody

    The problem is that I cannot use the "NavigateTo" method because is not going to another URL, is a navigation under the same URL (Developers are using a href=# to specify that is on the same URL  the functionality)

    Please keep me posted if you find anything weird on your side using IE and Anchor.Click method

    Thanks
    Julio
  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 01 Oct 2012 Link to this post

    Hello Julio,

    Technically the following URL examples are different URL's and you can use NavigateTo to get to them:

    http://myserver.com/myappPath/myappPage.aspx/?query1=abc
    http://myserver.com/myappPath/myappPage.aspx/?query1=abc#loc1
    http://myserver.com/myappPath/myappPage.aspx/?query1=abc#loc2

    The href of the hyperlink may only contain "#loc1" but that is still translated by the web browser into a full and complete URL which the browser then sends a request to the web server to obtain. So in the end yes you still can use NavigateTo for a fragment identifier.

    Please keep me posted if you find anything weird on your side using IE and Anchor.Click method

    Can you give me a public URL I can access to reproduce this symptom? Then I'd be very happy to investigate the cause.

    Regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  5. Julio
    Julio avatar
    6 posts
    Member since:
    Aug 2012

    Posted 01 Oct 2012 Link to this post

    Thanks Cody

    I couldn't access the URL's you gave me, BUT I will give a try with this approach, thanks

    Sure, here is the URL where you can play with and see more clearly what my problem is:
    https://vmp-euwebapp-001.alldata.com/alldata/user/login/

    You don't need to login, the fail is presenting when clicking the Span (Language Selector) (Located on the Top-Right corner),
    Remember I'm having the issue with IE only

    Here is the code used,
    myManager.ActiveBrowser.Window.SetFocus();                       
                        myManager.ActiveBrowser.Find.ByContent<HtmlSpan>("Deutsch").Click();
                        if (myManager.ActiveBrowser.BrowserType != BrowserType.InternetExplorer)
                        {
                            myManager.ActiveBrowser.Find.ByExpression<HtmlAnchor>("href=#", "innerText="English").Click();
                        }
                        else
                            myManager.ActiveBrowser.Find.ByExpression<HtmlAnchor>("href=#", "innerText="English").MouseClick();

    Any other thing just let me know


  6. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 01 Oct 2012 Link to this post

    Hi Julio,

    The URL's in my last message are not real URL's. They were meant to demonstrate the pattern. They will not take you to a real website.

    I am not able to connect to that URL. The name will not resolve - see attached screen shot. Else I'd be happy to look into this.

    Kind regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  7. Julio
    Julio avatar
    6 posts
    Member since:
    Aug 2012

    Posted 02 Oct 2012 Link to this post

    Hi Cody
    Please try with this one:

    https://app.alldata.com/alldata/user/login/

    This should work for you
    Please keep me posted if you find anything
    Thanks
  8. Answer
    Cody
    Admin
    Cody avatar
    3360 posts

    Posted 03 Oct 2012 Link to this post

    Hi Julio,

    I found out a couple of key things about your application:
    1) It's using jQuery events. Test Studio generally doesn't activate these events.
    2) Your application is changing which jQuery event gets attached depends on which browser is being used. This is clearly demonstrated in the first two attached screen shots.

    I came up with a different solution that works across browsers, but because of the variable event in IE we still have to have an IF just to handle that case:

    if (ActiveBrowser.BrowserType == BrowserType.InternetExplorer)
    {
        Actions.InvokeScript("$('#en_GB a').mousedown()");
    }
    else
    {
        Actions.InvokeScript("$('#en_GB a').click()");
    }

    To change to one of the other languages replace en_GB with the other desired ID (see last attached screen shot). Kind regards,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  9. Julio
    Julio avatar
    6 posts
    Member since:
    Aug 2012

    Posted 03 Oct 2012 Link to this post

    Thanks Cody for taking a deeper look at this
    Now I can see why the difference

    I appreciate your help to clarify that this is not a Telerik's bug
    I'll do a workaround to handle this behavior.
Back to Top