Add exception handling for invalid xPaths with helpful debug message