I've searched around stackoverflow and github but haven't seen a solution to this one.
session <- read_html("http://www.whitepages.com")
form1 <- html_form(session)[[1]]
form2 <- set_values(form1, who = "john smith")
submit_form(session, form)
After the submit form line, I get the following:
Submitting with '<unnamed>'
Error: not compatible with STRSXP
I've pieced together that this error is usually from mismatched types (strings and numeric, for example), but I can't tell where that might be happening.
Any help would be greatly appreciated!
I just had this problem myself, and I found that the error was happening when submit_form() called the function rvest:::submit_request(), which tries to run this line:
xml2::url_absolute(form$url, session$url)
In this line, R tries to create an absolute url which throws an error because either form$url or session$url is NULL. In my case, session$url was NULL for some reason. So you should probably try:
session$url <- "http://www.whitepages.com"
submit_form(session, form2)
Try to change the URL of your form into an empty string
form2$url <- ""
before submitting it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With