0

I am submitting a form value's through selenium and java. On the form initially I'm searching a product and selecting some values. Then it's showing a pop-up window with scroll to the pop up; see the first image.

enter image description here

Here I have to submit a form and for that I need to click on submit button. It's showing an error that "Element is not Visible". But when I scroll down to pop-up manually then submit button is available. As shown in below screenshot. enter image description here

Is there any way that I have to scroll down page manually?

2 Answers 2

1

Make sure to aceess the pop up window beofore scrolling, else it may not work as intented.You need to use JavascriptExecutor for to scroll effect via scripts. in order to use it see below snippets :

Scroll down:

WebDriver driver = new FirefoxDriver();
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("window.scrollBy(0,250)", "");

Scroll up:

jse.executeScript("scroll(0, -250);");

Note the difference in scroll parameters.

Hope this helps

0

You can execute javascript code with executeScript. Try something like this:

public void scrollDownAndClickSubmit() {
    executeScript("scroll(0, 250);");
    clickOnSubmitButton;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.