Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

[Selenium] Converting XPath locator with CSS.

According to selenium’s web site, CSS locator is not only powerful, but also fast.
But despite of that, I was hesitated and kept using xpath, mainly because I hadn’t had idea about how to search by innertext.

Until yesterday, I find that the pseudo class :contains() suit my need. Even better, it supports regex, yay!

But the main push is that XPath is incapable of dealing with certain tags, such as <span>, <label>.

So CSS, here I come!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: