Skip to content

fix(sdk-trace-web): pass optimised parameter recursively in getElementXPath#6346

Open
RIT2006ESH wants to merge 1 commit intoopen-telemetry:mainfrom
RIT2006ESH:fix/getElementXPath-optimised-recursive
Open

fix(sdk-trace-web): pass optimised parameter recursively in getElementXPath#6346
RIT2006ESH wants to merge 1 commit intoopen-telemetry:mainfrom
RIT2006ESH:fix/getElementXPath-optimised-recursive

Conversation

@RIT2006ESH
Copy link

Description

The getElementXPath function was not passing the optimised parameter recursively when traversing parent nodes. This caused child elements of parents with IDs to get full paths (e.g., //html/body/div) instead of optimised paths using the parent's ID (e.g., //*[@id="parent-id"]/div).

Changes

  • Fixed the recursive call in getElementXPath to pass optimised instead of false
  • Added test case to verify the fix

Fix

- xpath += getElementXPath(target.parentNode, false);
+ xpath += getElementXPath(target.parentNode, optimised);

Fixes #6323

…tXPath

The getElementXPath function was not passing the optimised parameter recursively when traversing parent nodes. This caused child elements of parents with IDs to get full paths instead of optimised paths using the parent's ID.

Fixes open-telemetry#6323

Signed-off-by: rino_303 <singhritesh31836@gmail.com>
@RIT2006ESH RIT2006ESH requested review from a team as code owners January 28, 2026 20:53
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 28, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: RIT2006ESH / name: Ritesh Singh (6b6f2c6)

@overbalance
Copy link
Contributor

This fix is already in progress: #6335

@RIT2006ESH
Copy link
Author

Sir can u pls guide me on what are the issues that I could contribute in as I am new in open source contribution as I am trying for GSOC...It will really be helpful...

@overbalance
Copy link
Contributor

@RIT2006ESH Appreciate your desire to contribute! I don't see any "good first tickets" at the moment, but take a look through https://github.com/open-telemetry/opentelemetry-js/issues and see if there's anything that you can start solving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getElementXPath does not pass parameter optimised recursively

2 participants

Comments