Test takes too long to click on element using XPath
I'm doing a test where I have to click on some "Yes" buttons and I can only access those buttons using XPath but with code I'm using:
Driver.Session.FindElementByXPath("//Pane[@AutomationId='Requisitos de Pasta']").FindElementByXPath(".//Pane[@AutomationId='picBoxYes']").Click(); or Driver.Session.FindElementByXPath("//Pane[@AutomationId='Requisitos de Pasta']//Pane[@AutomationId='picBoxYes']").Click();
The test takes 14~15 sec to click on each element. Is it a normal issue?
Hi @ycoliveira,
Element search using Xpath is known to take longer than other locator attributes. We're looking into improving Xpath performance if possible.
It would be a dirty hack but xpath performance for children level elements can be improved. if the starting node of xpath indicated only child level object, this would not need the inner program (object locator of driver) to trace down all the decedents. I assume in such cases there would not be any need for WinappDriver to make an XML for all the objects and hence faster result can be acheived.
XPath performance was improved with WinAppDriver v1.1.1.