Java中的Selenium-无法进入下一页

问题描述

public void pagination(String palavraProcurar) throws InterruptedException,IOException {
        // Optional. If not specified,WebDriver searches the PATH for chromedriver.
        System.setProperty("webdriver.chrome.driver","D:\\Downloads\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();

        // Open site to analyze
        driver.navigate().to("https://www.**HiddenStore**.com/stores/continente/pt-pt/public/Pages/searchResults.aspx?k="+palavraProcurar+"#/?page=2");
        String html=driver.getCurrentUrl();

        // Printing result here.
        System.out.println(html);
        Thread.sleep(3000);

        //next page
            driver.findElement(By.className("next")).click();

            System.out.println(driver.getCurrentUrl());
        

        /**
         * 
        //Give to JSOUP
        Document doc = Jsoup.parse(driver.getPageSource());
        trabalharSite(doc);

         **/


        driver.close();
        driver.quit();
    }

浏览器会自动打开,但是当我想自动单击下一页时,出现此错误:

线程“主”中的异常org.openqa.selenium.ElementClickInterceptedException:元素单击被拦截:元素...在点(1021,954)不可单击。其他元素将获得点击:...

检查页面,我知道下一个按钮在“ next”类中。我附上了图片。

Inspect element of next button

谢谢你们!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)