Akadisoft
Akadisoft

Reputation: 306

checking for xpath selector in rails using capybara

I am checking a label with text like

user's email can't be blank

I am testing it as follow:

 assert_selector(:xpath,"//label[text()[contains(.,'user''s email can''t be blank')]]")

but it is not working.

Also I tried this:

assert_selector(:xpath,"//label[text()[contains(.,'user\'s email can\'t be blank')]]")

Can some please tell me how to check for selector?

Upvotes: 0

Views: 56

Answers (1)

alecxe
alecxe

Reputation: 474231

How about you reverse the quotes:

assert_selector(:xpath, '//label[contains(., "user\'s email can\'t be blank")]')

Upvotes: 1

Related Questions