Home > Net >  Selenium-webdriver, I cannot go to the modal window
Selenium-webdriver, I cannot go to the modal window

Time:10-13

I am new to automated testing. Faced such a problem, earlier in the test I go to the Iframe window to enter the "test card" data. Instead of "success page", a modal window is displayed on which I need to click. Selenium swears.

..............

await driver.switchTo().frame(driver.findElement(By.xpath('//*[@id="solid-payment-form-iframe"]'))).then.....

..............................

`await button46.click().then(async function() {
  bot.sendMessage(-100********, land "\nTest completed!!✅");
  console.log(button46.click,'SubmitButton - done');
  
  return true//it existed
})  
await driver.switchTo().defaultContent();
 const number = await driver.wait(
  until.elementLocated(By.xpath('//*[@id="specialOffer"]/div/div[2]/div[1]/a'))
  // (By.xpath('//*[@id="specialOffer"]/div/div[2]/div[1]/a'))
  , 20000).then(number => {
return driver.wait(
  until.elementIsEnabled(number), 20000)})await number.click();`
   

This is what the console writes: ElementClickInterceptedError: element click intercepted: Element <a href="************************************* is not clickable at point (960, 536). Other element would receive the click: <iframe id="solid-payment-************************

Selenium webdriver javascript remote server - selenoid(aerokube)

CodePudding user response:

To click an element with selenium element.click the element should be visible and clickable, but your element might be outside of the visible area or might be behind a dialog box. Try clicking by injecting javascript. I have worked with the Python version of selenium so see python code and convert according to your need:

driver.execute_script("arguments[0].click()", button46)

CodePudding user response:

FIX PROBLEM:

   await driver.sleep(5000)
  const number1 = await driver.wait(until.elementLocated(By.xpath('//*[@id="specialOffer"]/div/div[2]/div[1]/a')))
  await driver.executeScript("arguments[0].click()", number1)```
  • Related