Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98787

Print and store Element after recieving with selenium (Python)

$
0
0

I got to the point of grabbing a list of elements by xpath but having trouble grabbing the html behind it.

with this I grab the followers found by the xpath and print them out as how many I received, but I need to get the html of that xpath so that I can recive the text included in them

 old_followers = 0
        followers = driver.find_elements_by_xpath('//*[@role="dialog"]//ul/div/li')
        dialog = driver.find_element_by_xpath('//div[@class="isgrP"]')
        while old_followers != followers:
            old_followers = followers

            driver.execute_script("arguments[0].scrollBy(0,600)", dialog)
            time.sleep(2)
            driver.execute_script("arguments[0].scrollBy(0,600)", dialog)
            time.sleep(2)

            followers = driver.find_elements_by_xpath('//*[@role="dialog"]//ul/div/li')
            print(len(followers))

Viewing all articles
Browse latest Browse all 98787

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>