1

I'm using selenium webdriver with chrome driver. My problem is:

In a page there is a timer of 10 secs. After the timer stops I need to click an element. When the timer is running the location of that element is (960,508) (this is just an assumption, because when the timer is running, it is not possible to inspect the element). When the timer stops, the element changes its position, now its position is (764,468). And when I try to click this element an error message is shown:

"Element is not clickable at point (960, 508). Other element would receive the click"

My question is, after the timer finishes, I'm able to locate the element at position (764,468). but I'm not able to click that element and in the error message the position is shown as (960,508).

Alpha
  • 13,320
  • 27
  • 96
  • 163
Amrutha
  • 301
  • 1
  • 7
  • 20
  • Some code would really be helpful for us in order to help you... – Mythul Feb 23 '15 at 06:53
  • driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); WebElement starttournament=driver.findElement(By.id("start")); System.out.println(starttournament.getLocation()); starttournament.click(); – Amrutha Feb 23 '15 at 07:38
  • Use an explicit wait to wait until element becomes clickable. – Priyanshu Feb 23 '15 at 08:29
  • your element might be under a modal dialog... provide absolute xpath to click over it... – Vivek Singh Feb 23 '15 at 10:36
  • please refer to this thread :[enter link description here](http://stackoverflow.com/questions/30300354/selenium-web-driver-chrome-exception-element-is-not-clickable-at-point/33235868#33235868) i answered this question here – fahad Oct 20 '15 at 11:52

2 Answers2

0

Use following piece of code.That might help.If it doesn't work, go through this link.

WebDriverWait wait = new WebDriverWait(driver, 15);

WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("ID of the element")));

Actions actions = new Actions(driver);

actions.moveToElement(element).click().perform():
Shoaib Mal
  • 89
  • 1
  • 7
  • I tried this piece of code. Now there is no error, but the click has no effect...! The next page which is to be loaded after the click hasn't loaded. – Amrutha Feb 23 '15 at 11:23
0

Try it using jquery

use explicit wait to wait for the element until its visible...then click on it using jquery

JavascriptExecutor jse = (JavascriptExecutor)driver;

If your using id

jse.executeScript("$(\"#id\").trigger('click');");

If your using class

jse.executeScript("$(\".class\").trigger('click');");

If your using name

jse.executeScript("$("\tagname[name="name of the element\"]");

Ex:

$("input[name='bt_login']").trigger('click');

Incase Jquery is not loaded/used in the site

Normally jquery is used in all websites...If jquery is not present in your website then load the contents of the jQuery code into a String from a JavaScript file (jquery.js, jquery.min.js or similar) and execute this String as JavaScript code using the WebDriver object.To load the jQuery file into a String you can use the Guava library.

URL jqueryUrl = Resources.getResource("jquery.min.js");
String jqueryText = Resources.toString(jqueryUrl, Charsets.UTF_8);
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript(jqueryText);

try using javascript

JavascriptExecutor jse = (JavascriptExecutor)driver; 
jse.executeScript("document.getElementById('tournament_timer').click();");

let me know if it works....

Vicky
  • 2,999
  • 2
  • 21
  • 36