Contributions
- 2.2KViews0likes0Comments
- 1.2KViews0likes0Comments
Exploring the Dom - Finding ChildNodes (Discussion Two)
I am unable to retrieve any child elements within a table. When using the following code, I am able to retrieve the entire row with no issue: 1. var xpath = "//tr/td/div[text() = 'Ryan STIG Regression Test']"; 2. var theVisitor = page.FindChildByXPath(xpath) 3. 4. if(theVisitor.Exists){ 5. 6. Sys.HighlightObject(theVisitor); 7. Log.Message(theVisitor.parentElement.parentElement.innerText); 8. } But when adding the following code : 8. Log.Message(theVisitor.parentElement.parentElement.cells[1].innerText); I receive a JavaScript runtime error. “TypeError: Cannot read property ‘innerText’ of undefined. This is a valid element search, as it works with no problem when utilizing the browser console via the dev tools Why am I not able to retrieve the child elements in TestComplete but I am in the browser console? Any help would be very much appreciated! Thanks in advance.Solved1.3KViews0likes2CommentsRe: Exploring the DOM - Finding ChildNodes
I am unable to retrieve any child elements within a table. When using the following code, I am able to retrieve the entire row with no issue: 1. var xpath = "//tr/td/div[text() = 'Ryan STIG Regression Test']"; 2. var theVisitor = page.FindChildByXPath(xpath) 3. 4. if(theVisitor.Exists){ 5. 6. Sys.HighlightObject(theVisitor); 7. Log.Message(theVisitor.parentElement.parentElement.innerText); 8. } But when adding the following code : 8. Log.Message(theVisitor.parentElement.parentElement.cells[1].innerText); I receive a JavaScript runtime error. “TypeError: Cannot read property ‘innerText’ of undefined. This is a valid element search, as it works with no problem when utilizing the browser console via the dev tools2.2KViews0likes2Comments