0
I need to make the comments (["COMENTARIO1","COMENTARIO2","COMENTARIO3"])
if you repeat N times in a random fill, the way I did, no matter how much I put 30 in the range, they are printed 3 times only.
def comente_foto(self):
for k in range(30):
driver = self.driver
driver.get("https://www.instagram.com/p/B_0ggQsjMJ-/")
time.sleep(3)
driver.execute_script("window.scrollTo(0, 90)")
time.sleep(random.randint(1,3))
comentarios = ["COMENTARIO1","COMENTARIO2","COMENTARIO3"]
driver.find_element_by_class_name('Ypffh').click()
campo_comentario = driver.find_element_by_class_name('Ypffh').clear()
campo_comentario = driver.find_element_by_class_name('Ypffh').send_keys(comentarios[k])
time.sleep(random.randint(1,2))
driver.find_element_by_xpath("//button[contains(text(),'Publicar')]").click()
time.sleep(random.randint(5,6))