Reputation: 33
I have the following code and I cannot figure out how to click on an element without getting "Element is not clickable at point"
error message.
You can also see that I am moving to the element before clicking it. The following code sample should fully work.
var webdriver = require('selenium-webdriver')
, By = webdriver.By
, until = webdriver.until;
var driver = new webdriver.Builder().forBrowser('firefox').build();
driver.get('http://www.vapeworld.com/');
driver.manage().timeouts().implicitlyWait(10, 3000);
for (i = 0; i < 5; i++) {
try {
driver.executeScript("try{jQuery('[name=\"" + i.toString() + "_name\"]')[1].click()}catch(Ex){};");
}
catch (Ex) {}
}
driver.findElement(webdriver.By.id('search')).sendKeys('pax 2'); //to enter text
driver.findElement(webdriver.By.className('button search-button')).click();
driver.findElement(webdriver.By.id('product-collection-image-2270')).then(function (element) {
driver.actions().mouseMove(element).perform();
driver.sleep(5000);
driver.actions().click(element).perform();
});
driver.quit();
Upvotes: 2
Views: 974
Reputation: 23805
You should try with .executeScript()
to perform click as below :-
Just change this line :
driver.actions().click(element).perform();
to this :
driver.executeScript("arguments[0].click()", element)
Hope it will work..:)
Upvotes: 2
Reputation: 1808
you are trying to click
on 'button search-button', make sure that no element is over lapping on your click
element.
Check whether your search results for 'pax 2' is overlapping the click
element or not.
If so, then click
on some other element which doesn't get overlapped due to search and make sure that click
doesn't make any changes on the page as you don't want it. (try by clicking on some label element)
And then try click
on the element you want.
Upvotes: 0