I'm running a Test Project in visual studios that is running test steps for a web page.
The web page itself is coded poorly. it has something like this:
<a id ="GenericButton" </a>
<div id="UniqueID" class="ThisDiv">
<a id ="GenericButton" </a>
</div>
The issue that I'm having is that I need to click the link inside the div "UniqueID". I don't want to click the first web button.
Using the code:
HtmlHyperlink myLink = new HtmlHyperlink(this.IE);
myLink.SearchProperties[HtmlHyperlink.PropertyNames.Id] = "GenericButton";
Mouse.Click(myLink)
Will result in clicking the first button instead of the button inside of the div "UniqueID"
I can get the div using:
HtmlDiv myDiv = new HtmlDiv(this.IE);
myDiv.SearchProperties[HtmlCheckBox.PropertyNames.Class] = "ThisDiv";
myDiv.SearchProperties[HtmlCheckBox.PropertyNames.Id] = "UniqueID";
//The below line is later referenced
int myDivTag = myDiv.TagInstance;
But how can I then capture the a frame inside of this div?
Furthermore, when debugging, the object myDiv doesn't seem to properly set itself in Visual Studios until running the line "int myDivTag = myDiv.TagInstance;". Why doesn't the debugger know which object I am referring to until after that happens?
I am using Visual Studio libraries for these operations instead of something like WatiN.