Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium C#: string contains

Tags:

string

c#

I have something like:

string result = Selenium.GetText("/html/body/form/div[2]");
if (result.Contains("test")
{
   bool found = true;
}
else
{
   found = false;
}

My problem is using result.Contains() returns false if there are tests, testing, etc. Also returns false for uppercase TEST, Test, etc

Is there another method that would match each character? Something like: result.Match("test");

Thanks for helping me out.

like image 699
Maya Avatar asked Jan 23 '26 09:01

Maya


1 Answers

string.StartsWith is a good start, and then Regex if you need more power

like image 98
kͩeͣmͮpͥ ͩ Avatar answered Jan 24 '26 23:01

kͩeͣmͮpͥ ͩ