R - RSelenium,按 Next 按钮并将下拉选项更改为 25

R - RSelenium, press Next button & change dropdown options to 25

OP 警告:我不太擅长 HTML。

我正在尝试使用 RSelenium 远程驱动器 (browserName='phantomjs') 在需要登录的页面上抓取一些 links。我能够处理登录部分,但是当我尝试提取 table 中的 link 时,我无法全部抓取,因为;

1- Table 的 10 行显示器的视图有限。这可以使用最多 25 个下拉选项进行更改。

 Things I have tried: 

 option <- remDr$findElement(using = 'xpath', "//*/option[@value = '25']")
 option$clickElement()

 As a result I get the ERROR: Element is hidden

2- 我无法按 table 底部的下一个按钮来查看下一页中的 link。

 Similarly, I think I was able to find all 4 buttons using findElement(). But when I run;

 buttons <- remDr$client$findElement("class name", "ag-paging-button")
 nextbutton <- buttons[[3]]
 nextbutton$click()
 nextbutton$clickElement()

然后 运行 "href" 提取 link 我得到了相同的 10 link 就好像什么都没发生一样。

我的问题可以通过完成第 2 部分来解决,但如果我也能得到第一个部分的答案,我将不胜感激。

这是我的 HTML 源代码的选定块的样子。

<div class="pxl-aggrid-pagesize">
   "Displaying: "
   
   <select id="pxl-ag-grid-pageSelect">
      <option value="10">10</option>
       <option value="15">15</option>
        <option value="20">20</option>
         <option value="25">25</option>
   </select>
</div>
    
    
    
    
<div class="ag-paging-panel ag-font-style">
   <span class="ag-paging-page-summary-panel">
      <button class="ag-paging-button" ref="btFirst" disabled type="button">First</button>
       <button class="ag-paging-button" ref="btPrevious" disabled type="button">Previous</button>
        "
                 Page "
        <span ref="lbCurrent">1</span>
        " of "
        <span ref="lbTotal">0</span>
        <button class="ag-paging-button" ref="btNext" disabled type="button">Next</button>
         <button class="ag-paging-button" ref="btLast" disabled type="button">Last</button>

我可以用 mouseMoveToLocation() 函数做到这一点。当然,它需要根据网站本身使用的布局进行修改。然而,它可能有任何好处;代码附在下面。

  allButtons <- remDr$client$findElements("xpath", "//button[@class='ag-paging-button']")
    allButtonsText <- sapply(allButtons, function(x)x$getElementText())
    nextButtonNumber <- grep('Next', unlist(allButtonsText))    

  remDr$client$mouseMoveToLocation(webElement=allButtons[[nextButtonNumber]])
    remDr$client$click(1)