Selenium Firefox webdrive, using Python, scrolling in div

后端 未结 1 704
别跟我提以往
别跟我提以往 2021-01-02 21:51

I have been using python for a while, I want to save specific webpages which require prior login. Since this website uses javascript, I decided to use selenium for python wi

相关标签:
1条回答
  • 2021-01-02 22:15

    You can use WebDriver.execute_script to execute javascript:

    eula = dr.find_element_by_id('eulaFrame')
    dr.execute_script('arguments[0].scrollTop = arguments[0].scrollHeight', eula)
    

    Arguments (eula in above example) passed to javascript can be accessed using arguments[..].

    Side note: If you use return in the javascript code, that value is available as the return value of the execute_script.

    0 讨论(0)
提交回复
热议问题