0

After resolve the wait and click problem I'm facing this one:

UnhandledPromiseRejectionWarning: "ElementClickInterceptedError: element click intercepted-bar-item icon-transfer">...</button> is not clickable at point (52, 346). Other element would receive the click: <div class="ut-".

How can we "implicit" click and ignore this kind of message?

the code to wait and click is as follow:

  await driver.wait(until.elementLocated(By.xpath("//button[text()='Transfers']")),15000);
  let btn= driver.findElement(By.xpath("//button[text()='Transfers']"));
  await driver.wait(until.elementIsEnabled(btn,15000));
  await driver.findElement(By.xpath("//button[text()='Transfers']")).click();

code inspect screenshot

GBouffard
  • 1,125
  • 4
  • 11
  • 24
Matheus Campos
  • 27
  • 1
  • 10
  • 1
    Possible duplicate of [Element MyElement is not clickable at point (x, y)... Other element would receive the click](https://stackoverflow.com/questions/44724185/element-myelement-is-not-clickable-at-point-x-y-other-element-would-receiv) – Mate Mrše Oct 03 '19 at 11:59

2 Answers2

3

Use below line code/element which is throwing error

var element = driver.findElement(By.xpath("//button[text()='Transfers']"));
browser.executeScript("arguments[0].click();", element );

javascriptexecutor of selenium will use javascript to click on element

protractor internally using selenium

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
  • what is this element on "element(by.id("myid"));" I got a reference error because element is not defined... – Matheus Campos Oct 03 '19 at 11:39
  • updated my answer its an normal element, just pass your element in browser.executeScript("arguments[0].click();", Element); – Shubham Jain Oct 03 '19 at 12:13
  • right... I don't have a "browser object" my script is something like: ` require('chromedriver'); const webdriver = require('selenium-webdriver'); var until = webdriver.until; var By = webdriver.By; async function myMain(){ let driver = new webdriver.Builder().forBrowser('chrome').build(); await driver.get('https://www.easports.com/fifa/ultimate-team/web-app/'); code to wait and click } myMain(); ` – Matheus Campos Oct 03 '19 at 12:22
  • you are using protractor or webdriverIO or selenium webdriverjs? – Shubham Jain Oct 03 '19 at 12:23
  • see this , I guess you are using webdriverjs .. refer this :https://stackoverflow.com/questions/52776654/execute-javascript-in-browser-using-selenium-javascript-or-webdriverjs – Shubham Jain Oct 03 '19 at 12:27
  • just change the java script parameter as per I have shown in answer – Shubham Jain Oct 03 '19 at 12:27
  • browser.executeAsyncScript("arguments[0].click();", element ); – Shubham Jain Oct 03 '19 at 12:44
  • 1
    Works like a charm <3 – Ram Guiao Nov 15 '19 at 02:58
2

Try replacing this line at the end await driver.findElement(By.xpath("//button[text()='Transfers']")).click(); with this one:

await driver.executeScript("arguments[0].click();", btn);
CEH
  • 5,701
  • 2
  • 16
  • 40