0

ページに存在するすべてのリンクの名前を印刷しようとしています。私は以下のコードを書きました-->

SystemUtil.Run "Chrome.exe","www.timesofindia.com"
Dim obj, objects,objectnames,i
Set obj = Description.Create
obj("micclass").value = "Link"
objects = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(obj)
MsgBox Err.number
For i = 0 To obj.Count-1 Step 1
    childnames = objects.getROProperty("innertext")
    print childnames(i)
Next

行で一般的な実行エラーが発生していますobjects = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(obj)

MsgBox Err.numberはエラー番号を示します-2147467259

エラー番号 2147467259 で原因を調べようとしましたが、関連する回答が得られませんでした。助けてください。

4

2 に答える 2

0

同じ問題が発生し、 on error resume next ステートメントを使用して解決しました

On error resume next
Set desc = description.Create
desc("micClass").value = "WebElement"
set WElementobj = browser("creationtime:=0").page("title:=.*").ChildObjects(desc)
msgbox welementobj.count
For i = 0 to welementobj.count-1
    print welementobj(i).getroproperty("innertext")
Next

この問題が発生する理由は、すべてのオブジェクトに innertext プロパティがあるわけではないためです。

于 2016-12-08T13:58:33.700 に答える