-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tag interfering with Xpath fix #14
Conversation
tarsier/tag_utils.ts
Outdated
const elTagName = el.tagName.toLowerCase(); | ||
const idStr = inputTags.includes(elTagName) ? `{${idNum}}` : `[${idNum}]`; | ||
// const idStr = inputTags.includes(elTagName) ? `{${idNum}}` : `[${idNum}]`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we jus delete the commented code?
@@ -162,36 +162,69 @@ window.tagifyWebpage = (tagLeafTexts = false) => { | |||
continue; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions a bit long and hard to read. Ideally we broke this apart but given this is a js utility file in a python project this should be fine.
tarsier/tag_utils.ts
Outdated
idToXpath[idNum] = getElementXPath(el); | ||
|
||
// create the span for the id tag | ||
// let idSpan = create_tagged_span(idStr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove all commented out code
const interactable = isInteractable(el); | ||
const elTagName = el.tagName.toLowerCase(); | ||
const idStr = inputTags.includes(elTagName) ? `{${idNum}}` : `[${idNum}]`; | ||
|
||
// create the span for the id tag | ||
let idSpan = create_tagged_span(idStr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a const
} else if (elTagName === "select") { | ||
// leave select blank - we'll give a tag ID to the options | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be simplified? This can be combined with the statement above
Inserting the tag while calculating the xpaths for elements was resulting in the tarsier tags interfering with xpath indexing for spans. I separated tag insertion out to a separate loop that runs after xpaths are calculated.