I want to verify the text present in placeholder. I have located the element and i am using Assert text command. I've entered the same string in value. On executing it is showing actual value did not match
3 Answers
Use assertAttribute
or verifyAttribute
command.
Example:
verifyAttribute | css=#search@placeholder | Sample String
Notes:
- In the Target column of Selenium IDE, you need to provide the proper path of the element followed by an @ sign and then the name of the attribute. (placeholder in your case)
- Using
verifyAttibute
will still continue running the test case once an error is detected while usingassertAttribute
doesn't.

- 323
- 2
- 13
-
Thanks @Rodel Bernal – dave Jul 11 '16 at 05:18
-
@dave It would be appreciated if you could at least accept my answer by clicking the check button. :) – Rodel Bernal Jul 11 '16 at 11:09
You need to understand that assertText function can only check static text on your webpage.
You must be getting an error message. This is perfectly normal.
What can help in this situation is using the assertAttribute or verifyAttribute functions.
Both these functions perform the same task; the former stops the test after receiving an error message in the text box while verifyValue just records the error in the log and runs the next commands.
While giving the target, either specify the XPath or refer by using the name=name@placeholder format.
You can find the name value by inspecting the box with a firefox addon called Firepath which runs with another firefox tool called Firebug. Install them if you don't already have.
Hope this helps!

- 1,116
- 10
- 21
Xpath contains() is the best way.
driver.find_element_by_xpath('//input[contains(@placeholder,"email")]')
Format : '//tag[contains(@attribute,"value")]'

- 868
- 10
- 17