1

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>
Kate Paulk
31.5k8 gold badges56 silver badges109 bronze badges
asked Sep 15, 2016 at 9:54
0

2 Answers 2

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);
Paul Muir
3,28219 silver badges35 bronze badges
answered Sep 15, 2016 at 14:50
1

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.

answered Sep 23, 2016 at 3:50

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.