Sure, get only the first few stack frames and parse them. Use getStackTrace
to get a StackTraceElement[]
and iterate through them until you get a frame in your package(or however else you want to filter) to get the correct line. The Selenium internal lines probably aren't the ones you need.
On this element you can call getMethodName
, getLineNumber
, and the like.