I've gone through numerous solutions for this issue and attempted all of them, but none seem to be effective. Despite its seemingly simple nature, I am struggling with the following task;
My objective is to extract a numerical value from a string and then compare it to check if it is greater than or equal to a specific number. I am specifically using Selenium IDE for this purpose.
The string in question is straightforward: XXX Total matches
, where XXX
represents the numeric value. I have stored this string by using the storeText
command, saving it in a variable appropriately named String.
To verify that I have correctly stored the string, I execute an echo
command to display "String," which successfully outputs the "XXX Total matches" string as expected.
I have experimented with various techniques mentioned for extracting the numeric portion of the string, such as regex, JavaScript, etc.
Among these methods, the one that appears to be functioning is
storeEval | String=String.slice(0, 2); | Number
. However, upon attempting to echo Number, it fails to show any output.
Despite trying alternatives like
javascript{(${String}.match(/\\d+/))}
javascript{parseInt(${String}, 10);}
javascript{parseInt(${String})}
Whenever I attempt these approaches, an error occurs in the Selenium IDE interface
[error] Unexpected Exception: fileName -> chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js, lineNumber -> 2531
While it may likely stem from a fundamental mistake typically made by newcomers, I am unable to pinpoint exactly what I might be doing inaccurately.