Web document caption
Posted: Fri Jun 03, 2011 12:08 pm
How can I find out what the caption of the current Web Document is?
Code: Select all
string strCaption = myDom.Element.GetAttributeValue("Caption").ToString();
Ranorex.WebDocument doc = ...; Container docCont = new Container(doc); string caption = docCont.Caption;This code works, since every WebDocument also supports the Container adapter, providing a Caption attribute, as can be seen in the Overview tab page in Ranorex Spy.
Recommended only since you do not need string constants when using Ranorex adapters and the compiler will check that you do not have syntax errors.Ciege wrote:Because you said "the Ranorex recommended way..." is there a reason why I should use your code or should not use my code?
If your code works, everything is ok and there is no downside to your method. Getting it to work initially is where the "recommended" method helps, since you have the compiler and code completion in order to get the attribute names correct.Ciege wrote:Since my method is not recommended, does that mean that I am potentially setting myself up for a future failure? Is one way really better than the other?