-1

Hi people: I'm trying o automate (Selenium with Java) a method that moves from a row to another (10 times) with the sendKeys. I tried with for cicle, but it's not working:

    public void moveToNextRow() {
       for (int i = 0; i < 10; i++) {
       this.myPage.FirstRow().sendKeys(Keys.ARROW_RIGHT);
    }

The other way that I tried was with IntStream, but also it's not working.

    public void moveToNextRow() {
       IntStream.iterate(1, n -> n + 1).limit(10).forEach(number -> 
       this.myPage.FirstRow().sendKeys(Keys.ARROW_RIGHT));
    }

Can anybody help me with that?

1
  • WHY is it not working? Whatever the answer is, changing the way you iterate from 1 to 10 isn't going to make a difference. Commented Oct 11, 2023 at 20:50

1 Answer 1

0
  • Maybe you should to include some delay in your code like
    TimeUnit.SECONDS.sleep(1);

or

{
    try
    {
        Thread.sleep(ms);
    }
    catch(InterruptedException ex)
    {
        Thread.currentThread().interrupt();
    }
}

Try increasing step by step, starting por 0.1 s

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.