Please try xpath by something like “//[local-name() = ‘svg’]" for svg tag and then you can access svg inside element like "//div/sort-direction/iron-icon/[local-name() = ‘svg’]/g/path”. Don’t trust on web spy since it won’t find anything about svg tag but the test can run with the xpath.
What are web components?
Web components are based on existing web standards. Features to support web components are currently being added to the HTML and DOM specs, letting web developers easily extend HTML with new elements with encapsulated styling and custom behavior.
<sort-direction>, <iron-icon> — these tags seem to be custom HTML tags based on the Web Components supported by browsers as an experimenting feature.
On the other hand, WebDriver (+ Katalon Studio) is based on the classic HTML and DOM specs. I suppose that the Recorder of Katalon Studio can not find the custom HTML tags based on the new Web Components Spec because these are out of the scope of the classic HTML & DOM specs.
His code enables you to send an XPath expression contained in a TestObject to browser, and let browser evaluate the expression using browser’s XPath engine over the page’s DOM, and return the evaluation result from browser to Katalon.
This method might be effective to the custom HTML tags based on the Web Components such as <iron-icon>