Element is not clickable at point
Meta -
OS: Windows 8.1 Selenium Version: 2.53.0, Browser: Firefox Browser Version: 45.0.1 (64-bit)
Expected Behavior -
I have some code in Java WebDriver In selenium build version 2.48.2 that: driver.findElement(By.xpath("//span/span/span[text()='Profiles']")).click()
worked well
Actual Behavior -
This execution has stopped working in build version 2.53.0: driver.findElement(By.xpath("//span/span/span[text()='Profiles']")).click()
I have ERROR:
org.openqa.selenium.WebDriverException: Element is not clickable at point (1056, 528). Other element would receive the click: <span role="img" id="button-1012-btnIconEl" class="x-btn-icon-el " unselectable="on" style=""></span>
Command duration or timeout: 78 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'SWMINDmadu', ip: '10.5.100.34', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_51'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=45.0.1, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: d7254e66-755d-4646-8f94-9a98ed0719fd
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:85)
at General.GeneralADMIN.LogIn(GeneralADMIN.java:27)
at Profiles.EventsTC.beforeTest(EventsTC.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.TestRunner.beforeRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:616)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1191)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
at org.testng.TestNG.run(TestNG.java:1024)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:112)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:176)
Steps to reproduce -
I think this is due to the fact: text()='Profiles'
This is very sad because 80% my elemets contain "text"
Please provide an html page (including JavaScript/ CSS) or a link to a page that reproduces the problem
Hi,
This is HTML:
<body id="ext-gen1018" class="x-body x-gecko" scroll="no"> <div id="ext-quicktips-tip" class="x-tip x-layer x-tip-default x-border-box" style="display: none;"> <div id="ext-gen1040" class="x-css-shadow" role="presentation" style="z-index: 19000; right: auto; left: 810px; top: 421px; width: 300px; height: 131px; box-shadow: 0px 0px 6px rgb(136, 136, 136); display: block;"/> <div id="rbtp-login-win" class="x-window x-layer x-window-default x-plain x-window-plain x-window-default-plain x-border-box" tabindex="-1" style="width: 300px; height: 135px; right: auto; left: 810px; top: 417px; z-index: 19001;"> <div id="rbtp-login-win-body" class="x-window-body x-window-body-default x-plain x-window-body-plain x-window-body-default-plain x-layout-fit x-window-body-default x-window-body-default-plain x-docked-noborder-top x-docked-noborder-right x-docked-noborder-bottom x-docked-noborder-left" style="width: 290px; height: 125px; left: 0px; top: 0px;"> <div id="form-1009" class="x-panel x-panel-default-framed x-fit-item x-window-item" style="margin: 0px; width: 290px; height: 125px;"> <div id="form-1009_header" class="x-panel-header x-header x-header-horizontal x-docked x-unselectable x-panel-header-default-framed x-horizontal x-panel-header-horizontal x-panel-header-default-framed-horizontal x-top x-panel-header-top x-panel-header-default-framed-top x-docked-top x-panel-header-docked-top x-panel-header-default-framed-docked-top" style="width: 290px; right: auto; left: -1px; top: -1px;"> <div id="form-1009-body" class="x-panel-body x-panel-body-default-framed x-panel-body-default-framed x-docked-noborder-top x-docked-noborder-right x-docked-noborder-bottom x-docked-noborder-left" style="width: 280px; left: 0px; top: 25px; height: 61px;"> <div id="toolbar-1011" class="x-toolbar x-docked x-toolbar-footer x-docked-bottom x-toolbar-docked-bottom x-toolbar-footer-docked-bottom x-box-layout-ct" style="width: 280px; right: auto; left: 4px; top: 90px;"> <div id="toolbar-1011-innerCt" class="x-box-inner " role="presentation" style="width: 274px; height: 22px;"> <div id="toolbar-1011-targetEl" class="x-box-target" style="width: 274px;"> <a id="button-1012" class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-small x-noicon x-btn-noicon x-btn-default-small-noicon" unselectable="on" hidefocus="on" role="button" style="right: auto; left: 193px; width: 75px; margin: 0px; top: 0px;" tabindex="0"> <span id="button-1012-btnWrap" class="x-btn-wrap" unselectable="on"> <span id="button-1012-btnEl" class="x-btn-button"> <span id="button-1012-btnInnerEl" class="x-btn-inner x-btn-inner-center" unselectable="on">Submit</span> <span id="button-1012-btnIconEl" class="x-btn-icon-el " style="" unselectable="on" role="img"/> </span> </span> </a> </div> </div> </div> </div> </div> </div> </body>
Sorry for structure but i don't have experience to adding commetns...
CSS:
.x-btn-default-small-icon .x-btn-inner, .x-btn-default-small-noicon .x-btn-inner { line-height: 16px; } .x-btn-default-small .x-btn-inner { color: #333; font-family: tahoma,arial,verdana,sans-serif; font-size: 11px; font-weight: normal; padding: 0 4px; }
Java Script:
`Ext.onReady(function() { Ext.QuickTips.init();
var loginPanel = new Ext.FormPanel({
labelWidth: 80,
url: 'j_spring_security_check',
frame: true,
title: Ext.translations.map['login.window.title.label'],
defaultType: 'textfield',
monitorValid: true,
items: [{
fieldLabel: Ext.translations.map['login.window.label.login'],
name: 'username',
allowBlank: false,
blankText: Ext.translations.map['login.window.blank.text']
}, {
fieldLabel: Ext.translations.map['login.window.label.password'],
id: 'login-form-password',
name: 'password',
inputType: 'password',
enableKeyEvents: true,
allowBlank: false,
blankText: Ext.translations.map['login.window.blank.text'],
listeners: {
keydown: function(field, e) {
if (e.getKey() === e.ENTER) {
doLogin();
}
}
}
}],
buttons: [{
text: Ext.translations.map['login.window.button.label'],
formBind: true,
scope: this,
handler: doLogin
}]
});
function doLogin() {
loginPanel.getForm().submit({
method: 'POST',
waitTitle: 'Logownie',
waitMsg: Ext.translations.map['login.window.wait.msg'],
success: function(form, action) {
var redirect = 'main';
window.location = redirect + "?lang=" + lang;
},
failure: function(form, action) {
if (action.failureType === 'server') {
obj = Ext.JSON.decode(action.response.responseText);
Ext.Msg.alert(Ext.translations.map['login.window.not.logged.msg'], obj.message);
} else {
Ext.Msg.alert(Ext.translations.map['login.window.alert.title'], Ext.translations.map['login.window.server.not.accessible'] + " : " + action.response.responseText);
}
loginPanel.getForm().reset();
}
});
}
` This is that button:
buttons: [{ text: Ext.translations.map['login.window.button.label'], formBind: true, scope: this, handler: doLogin }] });
This the same problem with: driver.findElement(By.xpath("//span[text()='Submit']")).click();
Environment
OS: Windows 10 Selenium Version: 2.53.0, Browser: Firefox Browser Version: 45.0.1 (64-bit)
Description
I got same behaviour today: but in my case: it caused by Select element after selecting option using selenium.
public ClientsPage setSendingAvailabilityAs(String value) {
Select select = new Select(driver.findElement(sendingAvailableDropdownLocator));
select.selectByValue(value);
return this;
}
My page is automatically scrolled to that select element (it is right behaviour?) then my button (form submit button) is overlapped by search field or button I want to click not visible in visible part of screen (due to overscrolling).
Workaround
I find workaround for it: scroll back to top. It solve my problem, but I think Select option SHOULD NOT scroll to Select element.
public ClientsPage setSendingAvailabilityAs(String value) {
Select select = new Select(driver.findElement(sendingAvailableDropdownLocator));
select.selectByValue(value);
WebElement element = driver.findElement(headerLocator); // located when button visible
Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.perform();
return this;
}
Does anyone have any solutions ?
I have problem with:
<span id="button-1012-btnInnerEl" class="x-btn-inner x-btn-inner-center" unselectable="on">Submit</span>
Does anyone reproduce this problem ?
Please, read through element is not clickable for ChromeDriver, the implementation is similar to the one Firefox have and try to fix your tests to follow the ChromeDriver approach.
@pumano To select from list, we need to click option elements, which requires focusing them first.
OK, I have some online example, everyone can reproduce my problem. In this case I use global page... Please try and tell if error is recurrent
Example:
`import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.AfterTest;
public class testTest {
public static WebDriver driver;
@BeforeTest
public void beforeTest() {
driver = new FirefoxDriver();
driver.manage().window().maximize();
}
@AfterTest
public void afterTest() {
}
@Test
public void f() {
driver.get("http://docs.sencha.com/extjs/4.2.4/extjs-build/examples/simple-tasks/index.html");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.findElement(By.name("title")).sendKeys("testNew");
driver.findElement(By.name("title")).sendKeys(Keys.ENTER);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
WebElement element = driver.findElement(By.xpath("//td[3]/div"));
Actions action = new Actions(driver);
action.moveToElement(element).build().perform();
driver.findElement(By.xpath("//td[7]/div/img")).click();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.findElement(By.xpath("//span[text()='Yes']")).click();
/////ERROR/////////
}
}`
@marious88 you should click on "a" html element (instead of span)
@mstankovic86 but I want to click using text: //span[text()='Yes'] or //div[3]/div/div/a[2]/span/span/span[text()='Yes']
Text is inside span. That doesn't work now. In earlier selenium works well.
<div id="messagebox-1001-toolbar" class="x-toolbar x-docked x-toolbar-footer x-docked-bottom x-toolbar-docked-bottom x-toolbar-footer-docked-bottom x-box-layout-ct" style="right: auto; left: 0px; top: 77px; width: 265px;">
<div id="messagebox-1001-toolbar-innerCt" class="x-box-inner " role="presentation" style="width: 259px; height: 24px;">
<div id="messagebox-1001-toolbar-targetEl" class="x-box-target" role="presentation" style="width: 259px;">
<a id="button-1005" class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-small x-noicon x-btn-noicon x-btn-default-small-noicon" tabindex="0" unselectable="on" hidefocus="on" style="display: none;">
<a id="button-1006" class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-small x-noicon x-btn-noicon x-btn-default-small-noicon" tabindex="0" unselectable="on" hidefocus="on" style="right: auto; left: 48.5px; top: 0px; margin: 0px; width: 75px;">
<span id="button-1006-btnWrap" class="x-btn-wrap" unselectable="on" role="presentation">
<span id="button-1006-btnEl" class="x-btn-button" role="presentation">
<span id="button-1006-btnInnerEl" class="x-btn-inner x-btn-inner-center" unselectable="on">Yes</span>
<span id="button-1006-btnIconEl" class="x-btn-icon-el " style="" unselectable="on" role="presentation"></span>
</span>
</span>
</a>
<a id="button-1007" class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-small x-noicon x-btn-noicon x-btn-default-small-noicon" tabindex="0" unselectable="on" hidefocus="on" style="right: auto; left: 129.5px; top: 0px; margin: 0px; width: 75px;">
<a id="button-1008" class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-small x-noicon x-btn-noicon x-btn-default-small-noicon" tabindex="0" unselectable="on" hidefocus="on" style="display: none;">
</div>
</div>
</div>
The problem is that when you try to click on coordinates of this span, there is another span nearby (the one with x-btn-icon-el class), which has the same size and coordinates. That's why both Firefox and Chrome raises such error.
A proper solution to this would be to adapt your tests to click on anchors, not their internal spans. For example, in this case you would click on "//a[normalize-space()='Yes']" element.
Closing this because it works as expected.
I agree that solve my problem.
Thanks!!
@mstankovic86 why should click "a" instead of span element? i try it and it work. but when i use selenium in old version not 2.53 , it is ok for using span....
@p0deje it is due to selenium's version upgrade ? i meet the same question when i upgrade the selenium.... it's ok when use /span[text()='Profiles'] in 2.48...
@justcby Yes, it's because of Selenium upgrade.
ElementNotInteractableException: Message: Element could not be scrolled into view this is error on Selecting the checkbox on the robot framework.please,give a solution