Error "object doesn't support this property or method: dbrowser.GetRoProperty"

StackOverflow https://stackoverflow.com/questions/22471913

  •  16-06-2023
  •  | 
  •  

質問

I was trying to run below script, but it's giving me an error that says:

object doesn't support this property or method: "dbrowser.GetRoProperty"

SystemUtil.Run "iexplore.exe","http://usps.com/"
Set dbrowser = description.Create

dbrowser ("micclass").value = "Browser"

dbrowser("openurl").value = "https://www.usps.com"
dbrowser("title").value = "USPS - The United States Postal Service (U.S. Postal Service)"
print(dbrowser.getroproperty("title"))
役に立ちましたか?

解決 2

Description.Create is used to create a 0-based Properties collection object. The variable dbrowser is preceded by the Set statement. Usage of Set statement binds an object as a reference to another object. Therefore, dbrowser becomes an object reference to the description object represented by Description.Create

A description object does not have a stand-alone use, but coupled with the ChildObjects method, it becomes an extremely powerful approach in dealing with AUT’s objects .For More Info, check link

So the code should be like

SystemUtil.Run "iexplore.exe","http://usps.com/"

wait(10)
Set dbrowser = description.Create

dbrowser ("micclass").value = "Browser"
dbrowser("openurl").value = "https://www.usps.com"
dbrowser("title").value = "USPS.*"   ''Using Regular Expression here 

Set colObject = Desktop.ChildObjects( dbrowser )

Print (colObject(0).GetROProperty("title"))

他のヒント

Your dbrowser object is of type Description not Browser you need to create a Browser object based on this description. Replace the last line with:

Print Browser(dbrowser).GetROProperty("title")

Note, there are two changes here

  1. Using Browser(dbrowser)
  2. Removing the parens from the print sub.

Edit: also note that descriptions are regular expressions by default so the parens in the title may cause problems, you should mark it as not regex.

dbrowser("title").RegularExpression = False
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top