Selenium could not be scrolled into view

Viewed 23

It seems that the element im trying to click, is not into view, so i need to await for it to appear, i found people using the following approach (i modified it with the xpath im trying to reach, it should work i think):

driver.wait(until.elementLocated({xpath: "/html/body/div[2]/div/div[3]/div/div[2]/div[3]/a"}), 5000).then(el => {
    el.click()
})

Although when i use it, it says that "until" is not defined, i dont know how to solve this problem in node, it seems i need to import that word but i just cant find what i need to import.

const {Builder} = require('selenium-webdriver');

(async function helloSelenium() {
    let driver = await new Builder().forBrowser('firefox').build();

    await driver.get('https://ramita-0.github.io/');

    // accediendo a la seccion javascript del portafolio
    await driver.manage().setTimeouts({implicit: 3000})
    await driver.findElement({linkText: "JAVASCRIPT"}).click()

    // accediendo al ejemplo de tabla
    await driver.manage().setTimeouts({implicit: 1000})
    await driver.findElement({className: "carousel-control-prev-icon"}).click()
    driver.wait(until.elementLocated({xpath: "/html/body/div[2]/div/div[3]/div/div[2]/div[3]/a"}), 5000).then(el => {
    el.click()
})
})();
0 Answers
Related