Get JavaScript Parameteres using selenium+BeautifulSoup4

Viewed 28

I would like to know what is the most efficient way to get the javascript config params using Selenium + BS4. I would like to get the input parameter in the following script:

   <script type="text/javascript">
    
        require.config.params['matchheader'] = {
            input: [162,13,'Crystal Palace','Arsenal','05/08/2022 20:00:00','05/08/2022 00:00:00',6,'FT','0 : 1','0 : 2',,,'0 : 2','England','England']
    ,
            matchId: 1640674
        };


</script>

Source Page

Any idea on how to do it?

Regards

1 Answers

That looks like it's global, so just:

object = driver.execute_script("return require.config.params['matchheader']")
Related