text I tried with the below selection logic, but i" /> text I tried with the below selection logic, but i" /> text I tried with the below selection logic, but i"/>

How to do goquery selection based on multiple attributes

770 Views Asked by At

How do we scrape the text of a below div tag using goquery

<div class="class_1" attr="attr_1">text</div>

I tried with the below selection logic, but it didn't work

divtag := doc.Find("div[class='class_1' attr='attr_1']")

I couldn't find example for goquery selection based on multiple attributes as above. Does goquery provide such functionality? How should we scrape it?

1

There are 1 best solutions below

0
vignesh On

It was a syntax issue on selection, the below selection worked.

divtag := doc.Find("div[class='class_1'][attr='attr_1']")