Reputation: 309
This is my issue, I have a Vba code using selenium that loops trough a lot of urls. I need to validate if one tag is present, and if it is I need the code to resume next, the problems is that I just started to use selenium, and I don't know how to validate if the tag is present in a given source code.
This is the tag:
<a class="fontdn" id="fontdn" href="#" title="Zoom Out (Key: -)">Zoom Out (Key: -)</a>
and this is the Vba-selenium code I have so far, this suppose to return the number of elements with this id but doesn't work.
If IE.findElementsByTitle("Zoom Out (Key: -)").Size() > 0 Then Exit For
Upvotes: 0
Views: 4643
Reputation: 9019
I checked the wrapper for Excel VBA, I don't see a findElementsByTitle
in the code: https://code.google.com/p/selenium-vba/source/browse/trunk/wrapper/WebElement.cs
You should be able to use:
If IE.findElementsByClassName("fontdn").Size() > 0 Then Exit For
Edit
I looked through the wrapper source some more, findElementsByClassName
returns an array. Excel VBA array uses Length
, not Size()
, from what I can tell.
Maybe this?
If IE.findElementsByClassName("fontdn").Length > 0 Then Exit For
Upvotes: 1