You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS: Windows 7 (and others)
Selenium Version: 2.53.0 (possibly others after 2.47)
Java version: 1.8.0_101 (also tried various others including 1.7.0_65)
Browser: Firefox (multiple versions between 34.0.5 and 44.0.1)
Expected Behavior -
If a button is partially hidden, trying to click it should do one of the following:
Throw an exception ("Element is not clickable ... Other element would receive the click")
Click correctly, presumably if the centre of the button is clickable.
Actual Behavior -
In certain cases, WebDriver thinks it has correctly clicked the button (no exception is thrown), but the button is not clicked. Works fine in Chrome. I believe this is a reproducable version of #1202
Steps to reproduce -
Run the following code (images attached for reference)
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class SeleniumTest {
static WebDriver driver;
static WebDriverWait wait;
static String url = "https://home.bt.com/login/loginform"; // any old URL that illustrates this well
static String xp = "//input[@value=\"Log in\"]";
static String txt = "";
public static void main(String[] args) {
System.out.println("Running under: " + System.getProperty("java.version"));
// setup
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
driver = new FirefoxDriver(capabilities);
wait = new WebDriverWait(driver, 30);
// do it (replicates issue on a screen resolution of 1920x1080)
tryIt(1400, 800); // button in view - OK... button clicked successfully, so page sends required fields red
tryIt(1150, 650); // totally hidden - OK... expected exception of 'Element is not clickable ... Other element would receive the click'
tryIt(1350, 650); // partially hidden - BUG?? webdriver thinks it clicked it, but nothing happens (fields don't go red)
driver.quit();
}
private static void tryIt(int x, int y) {
try {
System.out.println("Trying " + x + ", " + y);
driver.manage().window().setSize(new Dimension(x,y));
driver.get(url);
WebElement el = wait.until(ExpectedConditions.elementToBeClickable(By.xpath(xp)));
System.out.println(" Element is: " + el.toString() + " ... " + el.getLocation());
el.click();
System.out.println(" CLICKED OK");
}
catch (Exception e) {
System.out.println(" Caught exception (probably not clickable) "); // + e.getLocalizedMessage());
}
System.out.println("Done");
try {Thread.sleep(2000);} catch (InterruptedException e) {}
}
}
Image 1 // button in view - OK... button clicked successfully, so page sends required fields red
Image 2 // totally hidden - OK... expected exception of 'Element is not clickable ... Other element would receive the click'
Image 3 // partially hidden - BUG?? webdriver thinks it clicked it, but nothing happens (fields don't go red)
The text was updated successfully, but these errors were encountered:
this was actually fixed very recently and is a duplicate of #2497 23a24f5
The problem was we were attempting to click on the corner, but the corner is rounded and thus the click doesn't actually hit the button! Code was changed to check the middle of the borders first, then the corners if no side is found.
Marrowbones
changed the title
Clicking a partially hidden button is not handled correctly (Java WebDriver 2.53.0)
Clicking a partially hidden button is not handled correctly in Firefox (Java WebDriver 2.53.0)
Jul 26, 2016
Thanks - obviously my searching isn't as good as I thought.
Will there be a minor (bug fix) release of 2.53 at any point? I know you're all working on 3.0, but I think a lot of people would appreciate a pacthed version of the latest v2 stuff, as I'm guessing many people won't be able to immediately move to v3.
3.0 is coming soon... and there should be no reason to not move immediately to it. The only major difference is marionette:true is default, you'll need to set it to false (desired capability) to use the 'old' firefox driver.
OS: Windows 7 (and others)
Selenium Version: 2.53.0 (possibly others after 2.47)
Java version: 1.8.0_101 (also tried various others including 1.7.0_65)
Browser: Firefox (multiple versions between 34.0.5 and 44.0.1)
Expected Behavior -
If a button is partially hidden, trying to click it should do one of the following:
Actual Behavior -
In certain cases, WebDriver thinks it has correctly clicked the button (no exception is thrown), but the button is not clicked. Works fine in Chrome. I believe this is a reproducable version of #1202
Steps to reproduce -
Run the following code (images attached for reference)
Image 1
// button in view - OK... button clicked successfully, so page sends required fields red
Image 2
// totally hidden - OK... expected exception of 'Element is not clickable ... Other element would receive the click'
Image 3
// partially hidden - BUG?? webdriver thinks it clicked it, but nothing happens (fields don't go red)
The text was updated successfully, but these errors were encountered: