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

LiveHTML object corrupted after $click() #405

Open
mccarthy-m-g opened this issue Feb 28, 2024 · 1 comment · May be fixed by #413
Open

LiveHTML object corrupted after $click() #405

mccarthy-m-g opened this issue Feb 28, 2024 · 1 comment · May be fixed by #413
Labels
bug an unexpected problem or unintended behavior live 🐤

Comments

@mccarthy-m-g
Copy link

Brief description of the problem

I'm attempting to extract data from a paged table, but after using $click() the LiveHTML object becomes "corrupted". This may be an edge case with this specific website, as I was able to use $click() successfully from some other code examples in the Issues for this repo without this problem.

library(rvest)

sess <- read_html_live("https://www.cicic.ca/869/results.canada?search=&sect=2&int=3")
sess$click(".rgPageNext", n_clicks = 1)

sess
#> Error in onRejected(reason) : code: -32000
#>   message: Could not find node with given id

If you run this interactively with sess$view() you can see that the page loads successfully and the click works successfully, but after that sess seems to lose the information in html_elements (judging by the error).

Additional information

I asked on Mastodon and others were able to reproduce this error. I'm highlighting this because my initial thought was that this issue was caused by my browser being out of date due to OS restrictions, but that doesn't seem to be the case.

Software:

  • rvest: v1.0.4
  • R: v4.2.2
  • Browser: Chromium legacy (latest)
@hadley
Copy link
Member

hadley commented Mar 7, 2024

Oh I bet this is because it loads a new page, and I have not update the ID of the root node. I think this will be a reasonably simple fix when I’m next working on rvest.

jonthegeek added a commit to jonthegeek/rvest that referenced this issue Jul 11, 2024
Closes tidyverse#405.

I tried to make this automatic, and got it working some of the time, but I couldn't find a way to detect that something might change, and thus wait in that situation. I tried to make it as clear as possible for users to be able to fix this. Once a strategy is agreed on, the same strategy should probably be applied to other methods.
@jonthegeek jonthegeek linked a pull request Jul 11, 2024 that will close this issue
@hadley hadley added bug an unexpected problem or unintended behavior live 🐤 labels Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior live 🐤
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants