esra
esra

Reputation: 11

how can I scroll down more interests window at linkedin?

how can I scroll more interests window? I used the below code to reach all (more interests) company information, it doesn't work.

    element=driver.find_element_by_xpath("//div[@class='artdeco-modal artdeco-modal--layer-default  pv-interests-modal pv-profile-detail__modal--no-padding pv-profile-detail__modal pv-profile-detail__modal--v2']")
       
    element.send_keys(Keys.END)

Also the code driver.execute_script("window.scrollTo(0, Y)") runs on main page, not more interests page

Upvotes: 1

Views: 491

Answers (2)

pythonic_ai
pythonic_ai

Reputation: 49

You better use Pyautogui, it is a library to automate your mouse & keyboard movement.

I used this approach for the same problem. This question can also help you if you don't want to use Pyautogui

Upvotes: 1

arun n a
arun n a

Reputation: 906

There is a keyboard shortcut for scrolling that is, visit a web page and just enter the space key. The same thing you can implement in selenium.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep

scroll = 2 # how many times space key to be pressed to reach the end
for i in range(scroll):
    driver.find_element_by_tag_name("html").send_keys(Keys.SPACE)
    sleep(1)

Earlier I tried with "END" key also, but that time lost some data that is why i am using sleep over each scroll.

Upvotes: 0

Related Questions