I need to get the value "8.37" from the "data-rating" attribute.
<div class="ch-rating"> "VERYGOOD 8.37"
<div class="star-rating star-rating--alt star-rating--ch" data-rating="8.37" style="">
<span style="width: 83.7%;"></span>
</div>
</div>
In java there is .getAttribute() but I can't find the syntax in VBA.
I guess its something like this:
bot.FindElementByXPath("//div[@data-rating]"). followed by some syntax.
To get the value "8.37" from the "data-rating" attribute you can use the following line of code :
bot.FindElementByXPath("//div[@class='ch-rating']/div[@class='star-rating star-rating--alt star-rating--ch']").getAttribute("data-rating")
Syntax :
var attribute = element.getAttribute(attributeName);
where
As you are seeing Run-time error 438: Object doesn't support this property or method for HtmlElement.GetAttribute Method (String) here are some details :
Error 438 occurs when running a program in which a form is assigned to a variable and that variable is used to access a control on the form if the program is on a system running Windows 95 with Regional Settings set to a setting other than English (United States). The error text is:
Run-Time Error #438:
Object doesn't support this property or method
There are two possible workarounds for this problem.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Windows 98.
To reproduce this bug consistently, you will need HeapWalker, a utility that ships with the Windows 16-bit Software Development Kit and the 16-bit version of Visual C++.
Source : FIX: Error 438"Object Doesn't Support This Property or Method"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With