The problem statement goes this way: Find the % physical occupancy of ads on a webpage.
Eg. Say I have a URL which when opened has its content and 3 ads - one is an image ad and the other 2 are 'image and text' ad. (I have been given many such URLs with an unknown number of ads). I count the number of ads based on the bin class that had 'ad' or 'sponsored' in it and so I know there are 3 ads on its page. Now, I need to find the occupancy of these ads as a percentage of the entire web page i.e., say all three ads together occupy 20% of the page. How do I do it?
I understand that elements don't render the same in different browsers and I actually do not care about that. I just need a rough percentage based on Chrome (or Firefox - anything is okay).
A similar question asked back in 2013 How to programmatically measure the elements' sizes in HTML source code using python? has only 2 solutions and not much information. I found the API for the suggested package Ghost (the one agreed to by the asker as helpful) pretty difficult to understand.
I was asked to 'render a website' using a headless browser without ads first and then with ads and find a difference. Problem is, I don't know how. I also am just hoping that in the last 8 years someone to have come up with a simpler solution to this problem.
Since I am new to using Python for "scraping" in this manner - if it can even be called "scraping" - I could use any resources/ideas/documentations that you might know of.