In one sentence, you are combining the terms "stress test", "Selenium", and "javascript" which are mutually exclusive.
It is important to note that using actual browsers for stress testing is not recommended by:
Developers of Selenium:
They advise against using Selenium and WebDriver for performance testing, as it is not optimized for such tasks and may not yield accurate results.
Developers of WebDriver Sampler:
The project's aim is not to replace JMeter's HTTP Samplers but to work alongside them to measure end user load time.
If you believe you can do better than them, consider using XPath locator with partial text, like this example:
var idsin = WDS.browser.findElement(pkg.By.xpath('//button[contains(text(),"Consultar")'))
Keep in mind that the JavaScript mentioned has been removed from JDK 15, so you may need to exert extra effort or revert to an older JVM in the near future.
However, the optimal solution would be switching to JMeter's HTTP Request samplers. If properly configured to simulate a real browser, there should be no difference in network activity and you'll save time, money, and resources.