0

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

dave
  • 5
  • 1
  • 2

3 Answers3

0

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 using assertAttribute doesn't.
Rodel Bernal
  • 323
  • 2
  • 13
0

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!

absin
  • 1,116
  • 10
  • 21
0

Xpath contains() is the best way.

driver.find_element_by_xpath('//input[contains(@placeholder,"email")]')

Format : '//tag[contains(@attribute,"value")]'

Arun K
  • 868
  • 10
  • 17