访问< a> Angular网站上的元素 [英] Access <a> elements on Angular site

查看:61
本文介绍了访问< a> Angular网站上的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在AngularJS网站上用<a>元素填充数组.这是我的数组代码:

I am looking to fill an array with <a> elements on an AngularJS site. Here is my array code:

$ProgramGuides = $ProgramGuidesPage.ParsedHtml.getElementById("content") | foreach {
                    $_.getElementsByTagName("ul").item(0) | foreach {
                        $_.getElementsByTagName("li") | foreach {
                            $_.getElementsByTagName("a")
                        }

              }
}

$ProgramGuides仅返回1个<a>元素,同时页面上有10+个<a>元素.我只能想象这与Angular和ng-repeat有关.有什么想法可以将所有<a>元素放入数组吗?

$ProgramGuides only returns 1 <a> element meanwhile there are 10+ <a> elements on the page. I can only imagine this has something to do with Angular and ng-repeat on the elements. Any ideas how I can get all the <a> elements into my array?

这是Angular页面的HTML:

Here is the HTML of the Angular page:

更新:找到包含应用程序数据的XML文档!!

Update: Found the XML document with the app data!!

如何获取XML内容中的href值?

How can I grab the href values inside this XML content?

这就是我抓取内容的方式:

This is how I am grabbing the Content:

$XMLPage = Invoke-WebRequest -uri ("https://sellerweb.amerihome.com/api/ResourcesFiles?path=ProgramGuides") -WebSession $Amerihome

$XMLPage.Content

$ XMLPage上Get-Member的输出

Output of Get-Member on $XMLPage

推荐答案

很难从该屏幕截图中看到,但这是一般的想法:

It's hard to see from that screenshot, but this is the general idea:

$url = "https://sellerweb.amerihome.com/..."
$result = Invoke-WebRequest $url
$xml = [xml]$result.Content

一旦定义了XML对象,您就应该能够引用对象结构:

Once you have that XML object defined you should be able to reference the object structure:

$xml[0].Name
$xml[0].Link

这篇关于访问&lt; a&gt; Angular网站上的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆