NickaBrick
NickaBrick

Reputation: 81

Can't find input element within div, selenium java eclipse

Attached is the HTML

I am trying to find the input element with value "Save and Return."

I have tried to find it with xpath to the value text like so:

driver.findElement(By.xpath("//input[contains(@value,'Save and Return']")).click();

Upvotes: 3

Views: 403

Answers (1)

golyadkin
golyadkin

Reputation: 84

You need

driver.findElement(By.cssSelector("input[value=\\"Save and Return\\"]"));

Tell me if it doesn't work. Give more details about the errors. I might have mistaken about the escape characters \\ in the string.

Upvotes: 3

Related Questions