Open MohabMohie opened 6 months ago
@MohabMohie, thank you for creating this issue. We will troubleshoot it as soon as we can.
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template
label.
If the issue is a question, add the I-question
label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted
label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-*
label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer
label.
Thank you!
I had a look at this, as i had another issue with relative locators.
Without debugging i think this is related due to the definition of below
and rightOf
, both compare the value with <
.
e.g. element.left + element.width < other.left
, but other.left
is in this case identicall to element.left + element.width
(the table uses border collaps).
I am kind of surprised about this definitions, they are not very intuitive.
e.g. right of the < Previouse
button i would expect the orange area, but it is yellow one.
Is it realistic to change this e.g. with selenium 5? The implementation should be not to hard. e.g. for rightOf
: Take the rect of the element it should be relative to, move it by element.width
to the right and set the rect.width
to "max int", as soon as the element rectangle of the element to check intersects this rectangle it is a hit.
PS: the actual issue i hit is a case when the locators match multiple elements. e.g.
RelativeLocator.with(By.tagName("a")) .below(By.tagName("div"));
Will take the first By.tagName("div")
and return elements relative to it, not for all divs on the page.
I don't think many people use relative locators. Feel free to make a change and add a good commit message so it is shown in the release. No need to wait for Selenium 5.
We do use relative locators and came across this today. It seems to fail if the x position of the element to the right is the same as the x position of the left element plus its width.
What happened?
While teaching a class about test automation to the students of Saudi Digital Academy we wrote this code:
We expected to locate the name of the Contact but the actual behavior was that it located the name of the Country (Germany).
This is the website we used to test: https://www.w3schools.com/html/html_tables.asp Here's a screenshot of the target element and page dom:
How can we reproduce the issue?
Relevant log output
Operating System
Windows 11
Selenium version
Java 4.18.1
What are the browser(s) and version(s) where you see this issue?
Chrome 122.0.6261.70 (Official Build) (64-bit)
What are the browser driver(s) and version(s) where you see this issue?
Selenium Manager is downloading it automatically
Are you using Selenium Grid?
No