Getting unexpected result when using element.all(by.xpath()) to read table data
See original GitHub issueMy application contains two mat-tables on it. I would like to read the table data from my second table
await this.secondTableElement.all(by.xpath(//tr[${rowIndex}]/td[${columnIndex}]
));
but this statement actually provides me the data from the first table and not from the secondtableElement. I believe when you execute all() method under a parent element, protractor is supposed to search under this element and not from the very beginning of the HTML document.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Element should have been "select" but was "a" while trying to ...
UnexpectedTagNameException : Element should have been "select" but was "a" while trying to get the texts of dropdown menu using Selenium and Java....
Read more >XML Path Language (XPath) Version 1.0 - W3C
Abstract. XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer.
Read more >Top 10 Selenium Exceptions and How To Handle These ...
Handling Exceptions in Selenium WebDriver - In this tutorial we will learn about types of exceptions and how to handle top 10 most...
Read more >Chapter 4. XPath Functions and Numeric Operators - O'Reilly
The XPath 1.0 Recommendation specifies a number of functions and numeric operations that can be used to refine the results returned by an...
Read more >Web scraping using Python: requests and lxml - GitHub Pages
Traversing HTML and extracting data from it with lxml ... We can use XPath or CSS selectors to select what elements on a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Xpath is not recommended at all for any use by the protractor team. This is a section from the protractor style guide which you can locate here https://www.protractortest.org/#/style-guide. Generally I’ve had issues with xpath before so I absolutely never use it. I’m not sure if this here is a bug or just xpath’s broken behavior, but if you can go by without using it, then do go that route.
Then there is no reason why this should be selecting the wrong table. Have you tried using by.css rather than by.xpath?