I need help with below scenario. As the solution I am using is not working properly.
Scenario : I need to click on image 10 times fast, for the admin panel to open. This admin panel allows the change of environment for an app that I am testing with.
Below is the code I am using, there are no errors and the clicking is working however it is not clicking fast enough for the admin panel to open. Is there a way to optimize this to click faster?
It would be better to not findElement every time. Something like:
Element element = driver.findElement(By.xpath("element"));
Actions action = new Actions(driver);
for(int i = 0; i < 10; i++) {
actions.click(element);
}
Thank you for the suggestion to put findElement outside the loop. After some tweaking, I am able to perform the scenario successfully. Below is the code that is working.
MobileElement element = driver.findElement(By.xpath("element"));
Actions action = new Actions(driver).moveToElement(element);
wait.until(ExpectedConditions.elementToBeClickable(element));
for(int i = 0; i < 11; i++) {
action.sendKeys(Keys.ENTER).perform();
}