Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs Can';t访问动态生成表的所有行 背景信息_Reactjs_Powershell_Web Scraping_Automation_Browser Automation - Fatal编程技术网

Reactjs Can';t访问动态生成表的所有行 背景信息

Reactjs Can';t访问动态生成表的所有行 背景信息,reactjs,powershell,web-scraping,automation,browser-automation,Reactjs,Powershell,Web Scraping,Automation,Browser Automation,我正在尝试使用PowerShell和Internet Explorer COM对象构建web scraper。web scraper的目标是从页面上的特定表中获取数据,并将其存储起来,以供以后在脚本中使用 我不拥有这个网站,但我相信它是一个ReactJS应用程序,并且该表是在页面加载时动态填充的。 下面是我目前的代码:('domains-name'是我正在查找的行的类名) 我的问题 这让我得到了一个正确信息的数组,但它缺少了2行数据,我可以在页面和Chrome的页面检查器中清楚地看到这些数据。这

我正在尝试使用PowerShell和Internet Explorer COM对象构建web scraper。web scraper的目标是从页面上的特定表中获取数据,并将其存储起来,以供以后在脚本中使用

我不拥有这个网站,但我相信它是一个ReactJS应用程序,并且该表是在页面加载时动态填充的。 下面是我目前的代码:('domains-name'是我正在查找的行的类名)

我的问题 这让我得到了一个正确信息的数组,但它缺少了2行数据,我可以在页面和Chrome的页面检查器中清楚地看到这些数据。这是否是react在用户交互之前不呈现完整表的问题?我尝试在扫描页面之前添加5秒的暂停,但没有成功


任何帮助都将不胜感激

对于这类工作,您应该看看它是否易于与PowerShell一起使用(如果需要,我可以为您提供第一步)。我建议您只需使用
$IE.Document.getElementsByClassName('domains-name')
,或者如果有
id
属性,请使用
$IE.Document.getElementById('the-id')
$IE= New-Object -ComObject "InternetExplorer.Application"

$IE.navigate2(“https://www.example.com/control_panel")

while ($IE.busy) {
    start-sleep -milliseconds 1000
} 

$IE.visible=$false
$domainAddressArr = [System.Collections.ArrayList]@()

$IE.Document.IHTMLDocument2_body.getElementsByClassName('domains-name') | 
ForEach-Object {
    $a = $_.children[0]
    [void]$domainAddressArr.Add($a.toString())
}