Unable to scroll down in selenium

341 views
Skip to first unread message

Shibi kp

unread,
Nov 15, 2018, 8:38:06 PM11/15/18
to Selenium Users

OS Version:

Windows 8.1


Selenium Version:
Selenium version 3.14.0


Browser:

Firefox
-->

Browser Version:
63.0


Expected Behavior -

In web page webelement is present at end of the web page or middle of web page.
It should automatically scroll down and perform action in webelement.


Actual Behavior -

But we getting Error message as "could not be scrolled into view" and Exception as "org.openqa.selenium.ElementNotInteractableException".


Steps to reproduce -

  1. Launch firefox using selenium 3.14.0 (download the latest version of firefox)
  2. Go to URL ("http://automationpractice.com/index.php")
  3. Click the T- Shirt scroll down product will display.
  4. Need to Click the webelement.

Firefox ErrorMessage.txt

Please find the java code:-

driver.get("http://automationpractice.com/index.php");

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

System.out.println("Page title is: " + driver.getTitle());

Assert.assertEquals("My Store", driver.getTitle());

waitForPageLoad();

driver.findElement(By.xpath("(//a[text()='T-shirts'])[2]")).click();

String ProductName=driver.findElement(By.xpath("//a[@class='product_img_link']")).getAttribute("title");

String ProductPrice=driver.findElement(By.xpath("//span[@Class='price product-price']")).getText().trim().toString();

driver.findElement(By.xpath("//a[@Class='product_img_link']")).click();

Thanks & Regards,
Shibi KP

Firefox ErrorMessage.txt

Meenal Jain

unread,
Nov 19, 2018, 10:39:33 PM11/19/18
to seleniu...@googlegroups.com
Hi Shibi, 

Can you check if the element you want to access comes under an intake because as per error message it comes into view i.e. frame so if this is the case WWE've to first switch to the frame using driver.Switch.To("property of iframe");
Then only you can access any element within that view.  After you're done with that view you've to again switch back to default using driver.SwitchTo.Default();

Please let me know if you face any issue.  Also let me know if this works for you. 

Thanks, 
Meenal


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/1c4f58a7-3fa2-4c39-bfc5-0dd6cdb9882b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kpshibi

unread,
Nov 20, 2018, 1:44:56 AM11/20/18
to seleniu...@googlegroups.com

Hi Meenal,


I have check that element that is not iframe element. Because I have executed in other browser like chrome and IE it's working fine.

I'm facing error only in firefox only.

Thanks & Regards,
Shibi 

Meenal Jain

unread,
Nov 20, 2018, 7:57:00 AM11/20/18
to seleniu...@googlegroups.com
Hi Shibi, 

According to the exception, element is not interactable so can you try putting some wait before accessing the element. Also you can try finding the element using loop.If element gets found then don't scroll down  else scroll down more. Have you tried scrolling using javascriptexecutor? 

Thanks, 
Meenal


kpshibi

unread,
Nov 20, 2018, 8:53:54 AM11/20/18
to seleniu...@googlegroups.com
yes i have tried with Javascript but javascript operation have completed but action not happen in firefox browser.

I will try for wait page load function. or i will use thread.sleep().

Thanks @Meenal


Villju Joseph

unread,
Nov 20, 2018, 9:51:57 PM11/20/18
to seleniu...@googlegroups.com

Use JavaScript executor to scroll down

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages