3

Scenario: On clicking reset button value should disappear and the field that holds the value should reset to blank. Approach: My approach is to get text or innerHtml from id =mapPropertyHighlighted and make sure it is empty. Challenge: How do I make sure text from id should be blank? How to add assertion because get text() is returning blank if an element has no value and not sure how to add assertion for blank value? Is there any other way to verify value/text returned should be none/blank? enter image description here

6

I think in Python you can check for None or "" on Empty string

Some options:

self.assertEqual(element.text, None)
self.assertEqual(element.text, "")
self.assertEqual(len(element.text), 0)

Also check this question for other options: https://stackoverflow.com/questions/9573244/how-to-check-if-the-string-is-empty

  • 1
    Great..It worked.Thank you so much – Sara Oct 3 at 14:44
0

You can do assertation of null value for reset field.

public void testApp()
    {
        //true, check null
        assertThat(null, is(nullValue()));
        //or
        //true, check null
        assertThat(null, is(IsNull.nullValue()));

    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.