'VBA Selenium--> Not able to capture CSS element
I am a beginner and writing a code in VBA using selenium to extract information from ecommerce platforms. I wanted to capture for a particular product, information like # Sizes, sizes which are available and which are stocked out. Below is the code that i have written and the source code. I am able to get the # sizes and their names but not able to capture information like stock outs.
Source Code -->
<div class="size-swatch">
<div class="circel-size variant instock">
<span>L</span>
</div>
</div>
<div class="size-swatch">
<div class="circle-size variant oos">
<span>XL</span>
</div>
</div>
My VBA Code-->
'''
Set results = driver.FindElementsByCSS("circle-size variant oos")
For Each result In results
Worksheets("Sheet1").Cells(1, 40 + c).Value = results.Text
c = c + 1
Next
'''
Please help
Solution 1:[1]
driver.FindElementsByCSS("circle-size variant oos")
to make this Css work, you should remove the spaces and put a .
driver.FindElementsByCSS("div.circle-size.variant oos")
should get the job done.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | cruisepandey |
