How to continously scroll down a page until an element is located? Python selenium

前端 未结 3 1912
轮回少年
轮回少年 2021-01-24 16:06

I\'m baffled by the load more button for the skills section in Linkedin. I receive this error in finding the xpath for the button: selenium.common.exceptions.NoSuchElemen

3条回答
  •  时光说笑
    2021-01-24 16:50

    Try this

    actions.move_to_element(loadmore_skills).build().perform()
    

    Here is corresponding working Java Code

    @Test
    public void linkedInTest(){
        driver.findElement(By.name("session_key")).sendKeys(username);
        driver.findElement(By.name("session_password")).sendKeys(password);
        driver.findElement(By.xpath("//button[@class='btn__primary--large from__button--floating']")).click();
    
        driver.get("https://www.linkedin.com/in/kate-yun-yi-wang-054977127/?originalSubdomain=hk");
    
        WebElement loadmore_skills = driver.findElement(By.xpath("//button[@class='pv-profile-section__card-action-bar pv-skills-section__additional-skills artdeco-container-card-action-bar artdeco-button artdeco-button--tertiary artdeco-button--3 artdeco-button--fluid']"));
        action.moveToElement(loadmore_skills).click().build().perform();
    }
    

提交回复
热议问题