Unable to click() HtmlAnchor inside HtmlDiv

4 posts, 0 answers
  1. Chris
    Chris avatar
    2 posts
    Member since:
    Dec 2012

    Posted 15 Mar 2013 Link to this post

    I've created a unit test that runs perfectly in chrome but is unable to click or hover an HtmlAnchor when IE = browsertype. See attached DOM tree.

    [TestMethod]
            [TestCategory("Nightly")]
            public void SearchTest()                  
            {

                Manager.LaunchNewBrowser(BrowserType.Chrome);

                ActiveBrowser.NavigateTo("http://someURL.aspx");

                Pages.AdeptHome.AdeptLink.Click(false);

                Pages.AdeptWelcome.Markets.MouseHover();
                Pages.AdeptWelcome.Texas.Click(false);



  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 20 Mar 2013 Link to this post

    Hi Chris,

    ...but is unable to click or hover an HtmlAnchor when IE = browsertype

    What happens when it tries in IE? Do you get an error? Does the test think it worked but nothing happens in the browser? We'll need to be able to see the problem first hand by reproducing it on our machine before we can investigate what is causing the problem. Is it possible for us to get direct access to your application being tested (we don't need the source code, just a URL we can connect to)?

    Greetings,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Chris
    Chris avatar
    2 posts
    Member since:
    Dec 2012

    Posted 27 Mar 2013 Link to this post

    Hi Cody,

    Sorry for not responding sooner but I was able to solve the issue. Instead of defining the object as an HtmlAnchor, I defined it as an HtmlDiv and used the innertext property. The code looks like this...

    public HtmlDiv Texas
                {
                    get
                    {
                        return Get<HtmlDiv>("innertext=Texas", "tagname=div");
                    }
                }

    I also switched from Click() to MouseClick() and MouseHover()

    Pages.Welcome.Markets.MouseHover();
    Pages.Welcome.Texas.MouseClick();
  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 27 Mar 2013 Link to this post

    Hi Chris,

    I am very glad to hear you found a solution. Thank you for the update.

    All the best,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top