[ad_1]
I’m trying to scroll down a Div inside a website and I’ve tried almost everything and nothing works. execute_script won’t scroll it, actionchains won’t work, and with some other methods I’ve also failed.
This is the website: https://www9.senado.gov.br/QvAJAXZfc/opendoc.htm?document=senado%2Fsigabrasilpainelcidadao.qvw&host=QVS%40www9&anonymous=true&Sheet=SH14
If you click in “Gráficos Customizados” and at the left side there will be a few items to select. If you click on the plus sign of a few items it will expand and a scrollbar will appear. However, I haven’t found a way to scroll it down.
These are my selenium options
webdriver_manager = importlib.import_module("webdriver_manager.chrome")
options = webdriver.ChromeOptions()
# options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--single-process')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--window-size=1420,1080')
options.add_argument('--disable-gpu')
options.add_experimental_option("excludeSwitches", ['enable-automation'])
options.add_argument(f'user-agent={self.__get_user_agent()}')
driver = webdriver.Chrome(executable_path=webdriver_manager.ChromeDriverManager().install(), chrome_options=options)
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source":
"const newProto = navigator.__proto__;"
"delete newProto.webdriver;"
"navigator.__proto__ = newProto;"
})
params = {'behavior': 'allow', 'downloadPath': self.dir_path}
driver.execute_cdp_cmd('Page.setDownloadBehavior', params)
[ad_2]