尝试使用Selenium + Excel VBA从Chrome浏览器中的网站上抓取代码 [英] Trying with Selenium + Excel VBA to scrape code from a site in Chrome Browser

查看:879
本文介绍了尝试使用Selenium + Excel VBA从Chrome浏览器中的网站上抓取代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些指导,以在Excel(2013)VBE中使用Selenium Basic ChromeDriver(v 75.0.3770.140)从Chrome(v 75.0.3770.142)网站中抓取文本.

I need some guidance with scraping text from a website in Chrome (v 75.0.3770.142) using Selenium Basic ChromeDriver (v 75.0.3770.140) in Excel (2013) VBE.

这是HTML:

<div ng-if="!ShippingDetails.isShippingCreatedOutsideSH" ng-bind="ShippingDetails.code" class="">3333333</div>

我需要提取的部分是"3333333"

The portion I need to extract is the "3333333"

我仍然是Selenium Type Library的新手,到目前为止已经笨拙地尝试了这种新手尝试:

I'm still brand new to Selenium Type Library and have clumsily tried with this novice attempt so far:

Dim SHN As String
SHN = obj.FindElementByXPath("//div[@ng-if='!ShippingDetails.isShippingCreatedOutsideSH']/ng-bind[@'ShippingDetails.code']").Text
MsgBox SHN

推荐答案

尝试一下

Debug.Print .FindElementByXPath("//div[@ng-bind='ShippingDetails.code']").Text

这篇关于尝试使用Selenium + Excel VBA从Chrome浏览器中的网站上抓取代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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