0

On the page https://www.ameublement.com/showroom, I go to each brand but after 5-7 brands, the script can't go further because it needs to scroll the page. This is the error:

ElementClickInterceptedError: element click intercepted: Element is not clickable at point (389, 539). Other element would receive the click: <span ...

This is my code:

let swd = require("selenium-webdriver");
let browser = new swd.Builder();
let tab = browser.setChromeOptions().forBrowser("chrome").build();

async function main() {

    await tab.get("https://www.ameublement.com/showroom");

    // PAGE BRAND
    let brands = await tab.findElements(
        swd.By.css(".col-6.col-lg-12.card-img")
    );

    for (let e of brands) {
        console.log('go to page of a brand')
        await e.click()

        tab.sleep(300);

        // GO BACK
        tab.navigate().back()

        // await tab.executeScript("arguments[0].scrollIntoView();", e);
        // tab.getElementByClassName(e).scrollIntoView();

    };
}

I tried:

// await tab.executeScript("arguments[0].scrollIntoView();", e);

then I tried:

// tab.getElementByClassName(e).scrollIntoView();

The second one throw this error:

TypeError: tab.getElementByClassName is not a function

1 Answer 1

1

That's because tab is an instance of ThenableWebDriver which has no such function. Please see the link for documentation.

What you could do instead is use simple javascript to scroll, e.g.

await tab.executeScript("window.scrollBy(0,1000)");

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.