質問

I wanted to select an element through keyboard keys in Firefox. I am using this statement

driver.findElement(By.xpath("Element')]")).sendKeys(Keys.ARROW_DOWN);

But when I run it, I couldn't see any movement in the page. I am using JAVA to automate. This issue occurs even in BEHAT\MINK Tool.

My doubt:

  1. is this feature not working because of the developers code?
  2. or I need to modify my code to make it work?
役に立ちましたか?

解決

For scrolling page up/down, you can send keys on body tag element of the page, like following:

driver.findElement(By.tagName("body")).sendKeys(Keys.UP); //to scroll up
driver.findElement(By.tagName("body")).sendKeys(Keys.DOWN); //to scroll down
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top