문제

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