使用R完成web表单

使用R完成web表单,r,forms,authentication,web-scraping,R,Forms,Authentication,Web Scraping,我试图用R从一个网站上抓取一些数据,但每隔一段时间它就会询问我的密码。我怎样才能让R填写表格 表单的html代码如下所示: <form action="/en/login" method="post"> <input type="hidden" name="_target_path" value="http://website.com/" /> <div style="margin-top:10px;">

我试图用R从一个网站上抓取一些数据,但每隔一段时间它就会询问我的密码。我怎样才能让R填写表格

表单的html代码如下所示:

<form action="/en/login" method="post">
          <input type="hidden" name="_target_path" value="http://website.com/" />

            <div style="margin-top:10px;">
      <input type="text" id="username" name="_username" value="" class="inputLoginBox" placeholder="your username" tabindex="1"/></td>
    </div>
    <div style="margin-top:10px;">
      <input type="password" id="password" name="_password"  class="inputLoginBox" placeholder="your password"  tabindex="2"/></td>
    </div>
    <div style="margin-top:10px;">
      <input type="checkbox" id="remember_me" name="_remember_me" class="inputCheckbox" tabindex="3"/>
      <label for="remember_me">remember me</label>
      &nbsp;<a href='http://website.com/forum/ucp.php?mode=sendpassword' border="0" rel="nofollow" class="alt">forgot password?</a>
    </div>
    <div style="margin-top:10px;">
      <button type="submit" class="submitButton"  name="login[go]" tabindex="4" style="font-size:1.3em;">login</button>
      <br><br>
    </div>

</form>

记得我吗
登录



包rvest和功能表是一个选项。看这里:硒很好too@Nicol谢谢,这很有帮助。你知道在我按照链接中的说明操作之后,如何从网页中编写所有html代码吗?我当然试过写(读html(set),“file.txt”)。如果您通过xml2的read_html()捕获网页,那么您可以使用write_html()将其写入hd。