rvest
rvest copied to clipboard
How to pass arguments to html_form_set
From the documentation of html_form_set I read
Name-value pairs giving fields to modify.
But I'm not able to pass an existing list of name-value pairs (which I need to programmatically name/rename in my code).
Am I doing something wrong or is there an error in the code?
A small example The form:
> pgform
<form> 'login-form' (POST https://website.ext/admin/login/?next=/admin/)
<field> (hidden) csrfmiddlewaretoken: 48cy2g2QZGzzxVMws...
<field> (text) username:
<field> (password) password:
<field> (hidden) next: /admin/
<field> (submit) : Accedi
THIS WORKS
> login <- pgform %>% html_form_set(
username = "user",
password = "pass")
> login
<form> 'login-form' (POST https://website.ext/admin/login/?next=/admin/)
<field> (hidden) csrfmiddlewaretoken: 48cy2g2QZGzzxVMws...
<field> (text) username: user
<field> (password) password: ********
<field> (hidden) next: /admin/
<field> (submit) : Accedi
> session_submit(session,login,submit=NULL,user_agent(uastring),config(referer=arci$url))
But if I try to do this
> credentials <- as.list(c(username="user",password="pass"))
> login <- pgform %>% html_form_set(credentials)
The form doesn't get filled (BUT NO ERROR OCCURS)
> login
<form> 'login-form' (POST https://website.ext/admin/login/?next=/admin/)
<field> (hidden) csrfmiddlewaretoken: 48cy2g2QZGzzxVMws...
<field> (text) username:
<field> (password) password:
<field> (hidden) next: /admin/
<field> (submit) : Accedi