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