Prabhu
Prabhu

Reputation: 117

How can I escape double quotes in a Xpath in Selenium?

For Example:

By.xpath("//*[@id="ext-gen1035"]/div/div[3]/i")

Upvotes: 8

Views: 16741

Answers (1)

alecxe
alecxe

Reputation: 473763

You can actually use single quotes too:

By.xpath("//*[@id='ext-gen1035']/div/div[3]/i")

Or escape double quotes with a backslash:

By.xpath("//*[@id=\"ext-gen1035\"]/div/div[3]/i")

Upvotes: 13

Related Questions