c# - How to convert WebElement to string? -
here code i'm trying . i'm using c# basic if else statement compare.
iwebelement findtitle = driver.findelement(by.classname("heading3")); if (title = findtitle.text) { console.writeline("test pass"); } else { console.writeline("test fail"); }
you assigning value title
, not comparing it. use ==
compare
if (title == findtitle.text)
if want compare using ignore case use
if (findtitle.text.indexof(title, stringcomparison.ordinalignorecase) != -1)
this check if findtitle
text contains text of title
.
Comments
Post a Comment