Open titusfortner opened 2 years ago
I have just encountered this issue, and trying to find a workaround, so can confirm it still appears to be present
Sorry for the delay in response here. The initial HTML testcase actually works just fine for me locally on MacOS. Maybe there has something changed in the meantime? It would be good to know if the testcase is still valid for you @titusfortner. And if not what needs to be modified. Thanks.
I have resolved this with a workaround:
// Disables scroll bar appearing:
// causes issues with driver clicking this instead of the intended target
firefoxOptions.addPreference("widget.gtk.alt-theme.scrollbar_active", false);
firefoxOptions.addPreference("widget.gtk.overlay-scrollbars.enabled", false);
firefoxOptions.addPreference("layout.css.scrollbar-gutter.enabled", false);
firefoxOptions.addPreference("widget.windows.overlay-scrollbars.enabled", false);
I think the scroll bars behave differently depending on the OS, hence different preferences needed for Windows vs Linux (perhaps I have also just assumed this issue, just from description, is the same as the behaviour I was seeing - I didn't rerun the exact repro above, but I was using Linux env)
Well, the reproduction code I provided is not accurate, so there's that.
There were 5 tests failing for this issue in Java Selenium code: https://github.com/SeleniumHQ/selenium/blob/selenium-4.8.0/java/test/org/openqa/selenium/ClickScrollingTest.java#L119
It looks like 3 of them that were failing are now passing. These are 2 still failing that I've reproduced with Ruby here on public pages (MacOS, latest Selenium/FF/Geckodriver):
irb(main):019:0> driver.get 'https://www.selenium.dev/selenium/web/scrolling_tests/page_with_double_overflow_auto.html'
=> nil
irb(main):020:0> element = driver.find_element(id: 'link').click
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8: Element <a id="link" href="target_page.html"> is not clickable at point (39,820) because another element <html> obscures it (Selenium::WebDriver::Error::ElementClickInterceptedError)
and
irb(main):028:0> driver.get 'https://www.selenium.dev/selenium/web/scroll3.html'
=> nil
irb(main):029:0> driver.find_element(id: 'button2').click
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8: Element <button id="button2"> is not clickable at point (94,817) because another element <html> obscures it (Selenium::WebDriver::Error::ElementClickInterceptedError)
@titusfortner both cases work for me when I run on MacOS X. Do you have a more complete trace log for both? It's really strange that a html
element obscures an element living within the page itself.
Btw do you run those tests stand-alone or through the bazel test framework? If it's the latter which command would I have to execute? Maybe Selenium sets some preferences which might cause that failure?
@titusfortner I would appreciate if you find the time to give me the details in how to run the related tests. Thanks.
Looks like I have 13 open tickets on here, probably worth seeing if I can still replicate things.
this issue still occurs, reproduction in java:
public class Issue2013 {
private static final int PAGE_WIDTH = 100;
private static final int PAGE_HEIGHT = 30;
private File htmlFile;
private File getHtml() throws IOException {
if (htmlFile == null) {
StringBuilder builder = new StringBuilder();
builder.append("<html>");
builder.append("<body style=\"width: ").append(PAGE_WIDTH).append("em;\">");
for (int i = 0; i < PAGE_HEIGHT; i++) {
builder.append("<p>");
for (int j = 0; j < PAGE_WIDTH; j++) {
builder.append("<a href=\"#").append(i).append("-").append(j).append("\">");
builder.append("X");
builder.append("</a> ");
if (i != 0 && i != PAGE_HEIGHT - 1) {
break;
}
}
builder.append("</p>");
}
builder.append("</body>");
builder.append("</html>");
htmlFile = Files.writeString(File.createTempFile("issue2013_", ".html").toPath(), builder.toString()).toFile();
}
return htmlFile;
}
private void test(FirefoxOptions firefoxOptions) throws IOException {
FirefoxDriver firefoxDriver = new FirefoxDriver(firefoxOptions);
try {
firefoxDriver.manage().window().setSize(new Dimension(PAGE_WIDTH*5, PAGE_HEIGHT * 10));
firefoxDriver.get(getHtml().getAbsolutePath());
List<WebElement> links = firefoxDriver.findElements(By.tagName("a"));
for (WebElement link : links) {
link.click();
}
} finally {
firefoxDriver.quit();
}
}
/**
* This is failing.
*/
@Test
public void testOverlayScrollbars() throws IOException {
test(new FirefoxOptions());
}
/**
* This is passing.
*/
@Test
public void testSolidScrollbars() throws IOException {
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.addPreference("widget.gtk.overlay-scrollbars.enabled", false); // for linux platform
firefoxOptions.addPreference("widget.windows.overlay-scrollbars.enabled", false); // for windows platform
test(firefoxOptions);
}
}
I think issue depends on screen resolution where test is running.
Looks like I have 13 open tickets on here, probably worth seeing if I can still replicate things.
@titusfortner did you had a chance to check? I'm still not able to reproduce the issue. Thanks.
I'm not sure if this started failing with FF 99 or 100. An element is supposed to be scrolled into view at the bottom of the page and clicked.
The problem is that if there is a horizontal scroll bar on the page, it needs to wait a second before it goes away. If the scroll bar covers the center of the element, there will be an Element Click Intercepted.
Not sure if it needs to click through the scroll bar, or automatically wait for the scroll bar to go away like the user would.
System
Testcase
HTML: https://github.com/SeleniumHQ/selenium/blob/trunk/common/src/web/scrolling_tests/page_with_double_overflow_auto.html
This fails:
This passes:
Stacktrace