gandamu
gandamu

Reputation: 21

Python: xpath + regex with lxml and onclick?

Suppose I'm looking for all <a onclick=...> that call the String.fromCharCode javascript code. What's the simplest way to find all of them?

Upvotes: 2

Views: 742

Answers (1)

Zach Kelling
Zach Kelling

Reputation: 53879

You could use contains():

doc.xpath('//a[contains(@onclick, "String.fromCharCode")]')

Upvotes: 3

Related Questions