Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
Instagram selenium post button not working

I recently used selenium code to post a comment on one of my favorite posts. Everything works fine except when the comment is written in the text field and it must then be posted. how can I fix this issue?

 driver.find_element_by_class_name('Ypffh').click()  # click the field to insert comment
 field = driver.find_element_by_class_name('Ypffh')
 field.clear()
 typephrase(comment[counter], field)  
 sleep(delay)

The blow code does not work for posting comments. How can I fix it?

driver.find_element_by_xpath('//button[contains(text(), "Post")]').click()  # click the post 'comment' button element
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If it is a comment you are trying to post then I believe you don't have to click the post button, you could instead send the enter key to the text box element and this will post the comment. This will also be helpful, because it will still work if they ever change the HTML x-path of the post button element.

This is how I would do it, using your code from the first part:

from selenium.webdriver.common.keys import Keys

driver.find_element_by_class_name('Ypffh').click()  # click the field to insert comment
field = driver.find_element_by_class_name('Ypffh')
field.clear()
typephrase(comment[counter], field)  
sleep(delay)

field.send_keys(Keys.ENTER)

I hope that helps, sorry if it doesn't!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda