This is a migrated thread and some comments may be shown as answers.

execute click action on a div element

1 Answer 43 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 06 Feb 2015, 02:04 PM
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





1 Answer, 1 is accepted

Sort by
0
Accepted
Boyan Boev
Telerik team
answered on 11 Feb 2015, 07:52 AM
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
 
Tags
General Discussions
Asked by
Richard
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Share this question
or