execute click action on a div element

2 posts, 1 answers
  1. Jürgen
    Jürgen avatar
    4 posts
    Member since:
    May 2005

    Posted 06 Feb 2015 Link to this post

    Hi,

    I do have following HTML code:

    ... <a href='#'><div class='navTileLabel' style='color:#000000;' title='Testrubrik'>Testrubrik</div></a>...

    it is part of a framesource.

    I can find this element by following code:

    Browser frame = myManager.ActiveBrowser.Frames.ById("cat");
    Element testrubrik = frame.Find.ByAttributes("title", "Testrubrik");

    that works. And I would like to simulate a click on this element:

    frame.Actions.Click(testrubrik);

    that works not. Even if I use another way:

    myManager.ActiveBrowser.Actions.Click(testrubrik);

    or

    myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, testrubrik.GetRectangle());

    it does not what I want.

    What can I do to execute a click on this element?

    Best regards





  2. Answer
    Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 11 Feb 2015 Link to this post

    Hello Juergen,

    The issue here is not with the click action. Your find expression is slightly incorrect. It should look like:

    Browser frame = myManager.ActiveBrowser.Frames.ById("cat");
    HtmlDiv testrubrik = frame.Find.ByAttributes<HtmlDiv>("title=Testrubrik");
    //Click
    testrubrik.Click();
    //Real Click
    testrubrik.MouseClick();

    Hope this helps.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top