Forum Discussion
Hi,
Looks like problem is here:
Parent = Page.QuerySelectorAll(Parent_CSS); var all_Children = Parent.children;
querySelectorAll() method returns a list of matched elements. And then you are trying to apply children property to the list, which does not have it.
Try to use querySelector() instead or may be better:
var target_element = Page.contentDocument.getElementById("Schedule-01-Row1E-EndTime"); Log.Message(target_element.value);
- coffee8 years agoContributor
Thanks for the suggestion :smileyhappy:
I find the solution and tried it directly in Chrome (using native Javascript). It works fine, but unfortunately TC complains that something is not right .
var CSSselector = "#Detail > div > table > tbody"; Page = Sys.Browser('*').Page("http://www.myweb.com"); aqUtils.Delay(5000);
var par = Page.QuerySelectorAll(CSSselector); var child2 = par[0].childNodes[1].childNodes[4]; var finish = child2.querySelector('.validate[value]').getAttribute("value");Then I found that TC doesn't have method childNodes[i] but Child(i). (https://support.smartbear.com/viewarticle/88401/)
Therefore I changed it to
var child2 = par[0].Child(1).Child(4);
But still TC complains saying "TypeError par[0].Child is not a function".
How to find the n-th child and then the x-th grandchild in TC (and then possible the y-th grand grandchild) and grab it's attribute?
Thank You.
- Mathit6 years agoContributor
This worked like a charm
Related Content
- 4 years agoSuperTester
- 4 years agoSuperTester
Recent Discussions
- 2 days agovladd1