Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scraper not filling input when looking for INGENIERIA EN COMPUTACION #646

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

joaquintomas2003
Copy link
Member

El scraper esta teniendo un comportamiento flaky, en el que el input de buscar la carrera muchas veces no se llena.

El motivo es la aparición de este widget de que la pagina esta cargando:
image

  1. Esperar a saber que estamos en la pagina de buscar carreras haciendo find('span', text: 'Planes de estudio - FING').
    Esto lo hacemos para no matchear con el widget de la pagina anterior.

  2. Esperar a ver si aparece el widget .ui-widget-overlay , y hasta que no se vaya no usar el input.

@joaquintomas2003 joaquintomas2003 changed the title Fix scraper for real this time Fix scraper not filling input when looking for "INGENIERIA EN COMPUTACION'" Feb 1, 2025
@joaquintomas2003 joaquintomas2003 changed the title Fix scraper not filling input when looking for "INGENIERIA EN COMPUTACION'" Fix scraper not filling input when looking for INGENIERIA EN COMPUTACION Feb 1, 2025
Comment on lines 70 to 72
if page.has_css?('.ui-widget-overlay', wait: 5)
page.assert_no_selector('.ui-widget-overlay')
end
Copy link
Collaborator

@santiagorodriguez96 santiagorodriguez96 Feb 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me gusta la idea! Primero preguntás si está el modal y aguantás un rato hasta que aparezca. Si aparece esperás a que desaparezca. Si no aparece, quizás significa que ya apareció y se fue antes de hacer el chequeo por lo que seguirías de largo y en ese caso, en teoría, la página debería estar lista para usar el input del buscador.

La única pregunta que tengo es, es necesario el wait? Creo que por defecto Capybara espera dos segundos a que aparezca

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buena observación, no había necesidad de agregarlo :)

Copy link
Collaborator

@santiagorodriguez96 santiagorodriguez96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien metida!! 🚢

Comment on lines 70 to 72
if page.has_css?('.ui-widget-overlay')
page.assert_no_selector('.ui-widget-overlay')
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if page.has_css?('.ui-widget-overlay')
page.assert_no_selector('.ui-widget-overlay')
end
if has_css?('.ui-widget-overlay')
assert_no_selector('.ui-widget-overlay')
end

@joaquintomas2003 joaquintomas2003 force-pushed the jt--fix_scraper_not_filling_input branch from 58f5ead to 3902cb4 Compare February 1, 2025 21:48
@joaquintomas2003 joaquintomas2003 merged commit d3c8ffe into master Feb 1, 2025
5 checks passed
@joaquintomas2003 joaquintomas2003 deleted the jt--fix_scraper_not_filling_input branch February 1, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants