The int
value inside the bold span class is a count of results, which will vary. I want to find it so I can validate it against a database get
.
<span class="baseline float-left blocking-rule-table__extra-header-text">
<span class="bold">20</span> Results</span>
2 Answers 2
I know selenium with java.
I don't know the selenium in c#, but still crux would still be the same. You should use FindElement
by xpath then use the Text
property to get the value. That would be in String. Use TryParse
to convert to integer value if it is an integer.
String t=ext.FindElement(By.XPath("'.//*[@id='primary']/div[2]/div[1]/div[1]/span")).Text;
int value = 0;
int.TryParse(t, out value);
If the int appears every time after the word "Result" ,then simply split the text at "String t" by the letter "R". Pass the result in to an array. Select the [0]th element from the array. Bingoo.
Explore related questions
See similar questions with these tags.