recheck-web icon indicating copy to clipboard operation
recheck-web copied to clipboard

Path attribute should follow common format

Open beatngu13 opened this issue 6 years ago • 3 comments

Paths currently have the following form:

HTML[1]/BODY[1]/A[1]

The path represents the absolute XPath to the corresponding element. According to the XPath specification:

An absolute location path consists of / optionally followed by a relative location path.

Moreover, although the HTML specification says that "tag names are case-insensitive", they typically only consist of lower-case letters.

Therefore, we should start with / and use lower-case letters:

/html[1]/body[1]/a[1]

beatngu13 avatar Dec 18 '18 22:12 beatngu13

We filter out the path separator here at the beginning of the method. Changing this method could lead to many problems that are not directly apparent. We should discuss that. @beatngu13 @roesslerj

enesoezel avatar Jan 29 '19 14:01 enesoezel

Lowercase migrator merged in https://github.com/retest/recheck/pull/180. However, this doesn't address e.g. the leading slash. We should also think about enforcing our desired format in Path.

beatngu13 avatar Apr 24 '19 07:04 beatngu13

What I also realized and I think this is related: When copying a XPath from Chrome, one gets something like:

/html/body/div[2]

That is, [1] is omitted, so I think it should be optional in our XPath too.

beatngu13 avatar Oct 10 '19 20:10 beatngu13