Skip to content

More time taken for finding the elements in xPath #119

@DivyaPamarthi

Description

@DivyaPamarthi

Please find the sample Xpath below for our application.

MainWindow --> TopBar --> MainMenu --> Tools

Webelement = MainWindow -> TopBar (ControlType.Pane)
Webelement1 = WebElement -> MainMenu (ControlType.MenuBar)
Webelement2 = Webelement1 -> Tools (ControlType.MenuItem)

There are 2 webelements as highlighted above for which xpath is more or else similiar.
But the time taken to Webelement1 is 1 seconds, whereas to find Webelement2 it is taking more than 15 seconds.

Webelement1 Code: (Time ~ 1 second)

log.info 'Finding Main Menu'
WebElement Webelement1 = topBar.findElement(By.xpath("./*[${controlTypeEquals(ControlType.MenuBar)} and ${nameEquals('Main Menu')}]"))

Webelement2 Code: (Time ~ 15 seconds)
menuName ="Tools"
log.info 'Finding MenuItem'
WebElement Webelement2= Webelement1.findElement(By.xpath("./*[${controlTypeEquals(ControlType.MenuItem)} and ${nameEquals(menuName)}]"))

Both Webelement1 & Webelement2 are nearly performing same actions. But considering the time taken to find the webelement is having huge difference.
For Webelement1, it takes just a second - whereas for Webelement2 it takes nearly 15 seconds, which is huge for a test automation code.

Could you please help if something is done wrong here and anyway to reduce the timing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions