Merhaba, Python Selenium yeni öğreniyorum kendim bir şablon buldum onun üzerinden bir şeyler yaptım. Amacım herhangi bir Insgagram postundaki beğenenleri listelemek, bot instagrama giriş yapıp postu açıyor. Beğenenleri tıklayıp scroll 1 kez kaydırıyor ve kalıyor beğenenleri dosyaya yazmıyor. kodlar şu şekilde;
scroll = 0
while scroll < 4:
browser.execute_script('arguments[0].scrollTop = arguments[0].scrollTop + arguments[0].offsetHeight;', fBody)
time.sleep(2)
scroll += 1
followersList = []
followers = browser.find_elements_by_css_selector(".FPmhX.notranslate.MBL3Z")
for follower in followers:
followersList.append(follower.text)
with open("file/begenenler.txt", "a", encoding="UTF-8") as file:
for follower in followersList:
file.write(follower + "\n")
print("Daha fazla Scroll edilemiyor.")
time.sleep(5)
browser.close()