【发布时间】:2017-07-28 18:07:21
【问题描述】:
OP 警告:我不太擅长 HTML。
我正在尝试使用 RSelenium 远程驱动器 (browserName='phantomjs') 在需要登录的页面上抓取一些链接。我能够处理登录部分,但是当我尝试提取表中的链接时,我无法抓取所有链接,因为;
1- 表格有 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- 我无法按表格底部的下一步按钮来查看下一页中的链接。
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”运行链接提取,我得到相同的 10 个链接,就好像什么都没发生一样。
我的问题可以通过完成第 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>
【问题讨论】: