Hi All,
Recently I faced with issue related to element refresh flow. I am able to reproduce it on very simple flow.
The root cause of this issue is next:
Assume you are working with page which have 2 <div> panels with anchor inside panels. Anchor has equal ID's but different text.
Only one panel can be visible at the moment.
So, let's take anchor from second panel (suppose it visible now), then explicitly call refresh of this control. As result you will receive anchor from the first panel (which is invisible) and wrong control.
Below I provide code snippet with demonstrate this issue and attached sample web page.
This code snippet produced next output:
Requested Anchor: innerText - [Item5], tagIndex - [4]
Requested Anchor: innerText - [Item2], tagIndex - [1]
Reproduced on next configuration:
OS: Win 7 64
Browsers: IE9/10, Firefox/Chrome latest
TTF: 2012.2.1317.0
Any ideas how I can overcome this issue ?
Thanks,
Mykola
Recently I faced with issue related to element refresh flow. I am able to reproduce it on very simple flow.
The root cause of this issue is next:
Assume you are working with page which have 2 <div> panels with anchor inside panels. Anchor has equal ID's but different text.
Only one panel can be visible at the moment.
So, let's take anchor from second panel (suppose it visible now), then explicitly call refresh of this control. As result you will receive anchor from the first panel (which is invisible) and wrong control.
Below I provide code snippet with demonstrate this issue and attached sample web page.
string
localPageIE = @
"D:\DuplicateAnchorsID\DuplicateID.html"
;
Manager.Current.LaunchNewBrowser(BrowserType.InternetExplorer);
Manager.Current.ActiveBrowser.NavigateTo(localPageIE);
Manager.Current.ActiveBrowser.RefreshDomTree();
// get all anchors from second (visible) panel
ReadOnlyCollection<HtmlAnchor> linkWrappers = Manager.Current.ActiveBrowser.Find.AllByXPath<HtmlAnchor>(
"//div[@class='linksGroup2']//a"
);
// get second item from collection to demonstrate issue
HtmlAnchor linkItem = linkWrappers[1];
// log info before refresh call
_logger.Info(
string
.Format(
"Requested Anchor: innerText - [{0}], tagIndex - [{1}]"
, linkItem.BaseElement.InnerText, linkItem.BaseElement.TagNameIndex));
linkItem.Refresh();
// log info before refresh call
_logger.Info(
string
.Format(
"Requested Anchor: innerText - [{0}], tagIndex - [{1}]"
, linkItem.BaseElement.InnerText, linkItem.BaseElement.TagNameIndex));
This code snippet produced next output:
Requested Anchor: innerText - [Item5], tagIndex - [4]
Requested Anchor: innerText - [Item2], tagIndex - [1]
Reproduced on next configuration:
OS: Win 7 64
Browsers: IE9/10, Firefox/Chrome latest
TTF: 2012.2.1317.0
Any ideas how I can overcome this issue ?
Thanks,
Mykola