1

I am searching with a keyword "Mobiles" in search box it given the 450 results now i want verify that whether it is displayed 450 products not . My problem is per page we are displaying the 30 products as a result ,after we need to click On "LOAD MORE" link to see the remaining products ,but i am unable click on LOAD MORE button due to it is present at the bottom of a page if I scroll my page to that button and click again it displays the another 30 products in the same page , so now again i need to click on LOAD MORE link but again it will be at the bottom of the page due to that it is giving ELEMENT IS INVISIBLE exception.

Shortly what I want is :

Is there any method in selenium to scroll to particular element and clicking on it

Note: My Evn is Selenium+javascript+node.js.

0

I hope that I am understanding your question fully, I am going to attempt to answer it the best that I can. If you give selenium a location of the element, it should be able to click it; no matter how far scrolled down the page it is. Give the location of your button to selenium and it should click it wherever it is, however many times you need it to click it. Just make sure you give selenium a good locator for it, something like:

driver.FindElement(By.XPath"//a[contains(@href, '*add href*') and contains(text(), 'LOAD MORE')]".Click();

Of course where "a" is make sure you change it to whatever your element is, @href is another thing that you will need to change to whatever your button has in the html, and the last section of "text(), 'LOAD MORE')" is assuming the button has text on it that reads "LOAD MORE". Without any of your code this is the best I can do. Let me know if you have other questions.

  • 1
    Yes what you said is true,After the some R&D and some practice I am came to know that ,but for this locator should be given properly other wise it would fail .Any way Thank you very much @DEnumber50 – QAMember May 19 '15 at 5:52
  • No problem! happy coding. – DEnumber50 May 20 '15 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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