Suyog Sakegaonkar
Suyog Sakegaonkar

Reputation: 225

how to compare a variable with blank value in selenium?

I want to check whether the variable is storing blank value or not. I tried out comparing it with '' or "" or NULL or null, but does not work.

Upvotes: 0

Views: 2619

Answers (2)

Rohit Ware
Rohit Ware

Reputation: 2002

You can try out below solution

storeValue  |  element  |  test
store       |           |  j  (blank value)
gotoIf      |  storedVars['test']==storedVars['j']  |  true
getEval     |  alert("test Variable Value is not blank")
gotolabel   |  finish
label       |  true
getEval     |  alert("test Variable Value is blank")
label       |  finish

Upvotes: 1

Prashant Vadher
Prashant Vadher

Reputation: 1075

You can also use verifyEval command for this. Try following script,

verifyEval | this.page().findElement("id=gbqfq").value == '' | true

Upvotes: 0

Related Questions