I am having some struggle with my Selenium JS in New relic. I am trying to click an element and I am keeping get back the error "Element is not clickable at point". The solutions at the tread Selenium Web Driver & Java. Element is not clickable at point (x, y). Other element would receive the click are not really applicable to NewRelic. The snippet I am using is
.then(function() {
log(26, 'clickElement "//form[@id=\'giftcard-form\']/div[3]/div/button"');
return $browser.waitForAndFindElement(By.xpath("//form[@id=\'giftcard-form\']/div[3]/div/button"), DefaultTimeout); })
.then(function (el) { el.click(); })
I don't see anything wrong with the code and the element is visible on the page.
![enter image description here][1]
Any suggestions? it seems a common issue but I didn't have luck with the solutions offered in the other thread Thanks, Thomas
waitForAndFindElement will wait only for element present. It will not wait for element visibility.
Try by waiting for the visibility of the element,
.then(function() {
log(26, 'clickElement "//form[@id=\'giftcard-form\']/div[3]/div/button"');
return $browser.wait($driver.until.elementIsVisible($browser.findElement(By.xpath("//form[@id=\'giftcard-form\']/div[3]/div/button"))));
}).then(function (el) {
el.click();
})
If you are getting timeout error, then scroll to view and click.
.then(function() {
log(26, 'clickElement "//form[@id=\'giftcard-form\']/div[3]/div/button"');
return $browser.waitForAndFindElement(By.xpath("//form[@id=\'giftcard-form\']/div[3]/div/button"), DefaultTimeout); })
.then(function (el) {
$browser.executeScript("arguments[0].scrollIntoView()", el);
el.click();
})
If the scroll doesn't help, then at last go with javascript click,
.then(function() {
log(26, 'clickElement "//form[@id=\'giftcard-form\']/div[3]/div/button"');
return $browser.waitForAndFindElement(By.xpath("//form[@id=\'giftcard-form\']/div[3]/div/button"), DefaultTimeout); })
.then(function (el) {
$browser.executeScript("arguments[0].click()", el);
})