lundi 8 juillet 2019

Clicking "Load More" on webpages by using python

I am trying to load the whole content of this link

I tried so many tutorials like this one here, which teaches how to work with a similar issue (Infinite Scrolling Pages).

My issue is that I couldn't manage to specify the load more class on this page to click it. But, if I am not mistaken, it exists in this part of the webpage source code:

<ng-include src="'loader.html'" class="ng-scope">
    <div class="loading-div ng-scope ng-hide" ng-show="!loadingMoreData">
        <div class="spinner">
            <div class="bounce1"></div>
            <div class="bounce2"></div>
            <div class="bounce3"></div>
        </div>
    </div>
</ng-include>
<div class="block-hed block-link clearfix" data-ng-show="isMoreDisplayed" data-ng-click="getMoreMaterials()">
                    <h4 class="link-border-color"><a href="javascript:void(0)">المزيد </a></h4>
                </div>

I do not necessarily need to implement any function like "click()" or "perform()". Any way to show the whole content under load more button is considered.


by the way, this is my code so far:

from selenium import webdriver
browser = webdriver.Chrome("/home/aziz/anaconda3/lib/python3.6/site-packages/chromedriver/chromedriver")
am = browser.get("https://sabq.org/%D8%A7%D9%84%D9%85%D9%85%D9%84%D9%83%D8%A9/%D8%A5%D9%82%D8%AA%D8%B5%D8%A7%D8%AF")




Aucun commentaire:

Enregistrer un commentaire