Writing a crawler in VBA in combination with selenium to parse the price of different products from a webpage, I get an issue upon execution. It breaks when it finds certain prices are none. Using "on error resume next" I can get the full results. However, I wish to execute my code without using "on error resume next". If it were not for selenium, I could have used Length property to get rid of that. But, selenium doesn't support that. Hope I can have any workaround here.
Sub Redmart_scraping()
Dim driver As New ChromeDriver
Dim posts As Object, post As Object
With driver
.get "https://redmart.com/bakery"
Set posts = .FindElementsByCss("li.productPreview")
End With
On Error Resume Next
For Each post In posts
i = i + 1
Cells(i, 1) = post.FindElementByCss("span[class^=ProductPrice__price]").Text
Next post
End Sub