I am using the following method to parse some text on the page
getNumberText().getText()
and want to do a assert/comparison using greaterThanOrEqualTo
So How do I convert the getText() result to integer value for comparison?
I am using the following method to parse some text on the page
getNumberText().getText()
and want to do a assert/comparison using greaterThanOrEqualTo
So How do I convert the getText() result to integer value for comparison?
You could do the following, from this:
getNumberText().getText()
... create as one of answers was another method, which will return desired object in Your case int:
public int getNumber(){
return Integer.parseInt(getNumberText().getText());
}
so usage would be:
Assert.assertTrue(getNumber(), intNumber);
Hope this helps,
int number = Integer.parseInt(getNumberText().getText());
In case that String is not parseable (thus not integer), NumberFormatException is thrown.