How to get the scroll into view to work in Chrome. Using selenium web driver

I need to scroll down the page to the NEXT button. Only when the NEXT button is visible it can be clicked on. So I need to get the “scroll into view” to work.

$browser = Start-SeChrome
$browser.Navigate().GoToURL($url)

ForEach ($A_Element in (Find-SeElement -Driver $browser -TagName a))      
   { 
    If ($A_Element.Text -Notlike "Next"){Conitnue} 
    $A_Element.ScrollIntoView()
    #Invoke-SeClick -Element $A_Element       
    #$A_Element.Click() 
    sleep 2
    Break         
   }

 

The only thing I see in the code is that ‘Continue’ is spelled incorrectly.

If ($A_Element.Text -Notlike "Next"){Conitnue} 

Outside of that, you many need to find a forum specifically for Selenium as asking about usage is a bit to broad of an audience.

[quote quote=252152]The only thing I see in the code is that ‘Continue’ is spelled incorrectly.

PowerShell
<textarea class="urvanov-syntax-highlighter-plain print-no" style="-moz-tab-size: 4; font-size: 14px !important; line-height: 18px !important; z-index: 0; opacity: 0;" readonly="readonly" data-settings="dblclick">If ($A_Element.Text -Notlike "Next"){Conitnue} </textarea>
1
If ($A_Element.Text -Notlike "Next"){Conitnue}
Outside of that, you many need to find a forum specifically for Selenium as asking about usage is a bit to broad of an audience.

[/quote]
Yes sorry for the CONTINUE. This code is part of a larger code, so I had to put in just the lines that were relevant and messed up the continue. That was not the cause of concern through. It was the ScrollIntoView() that was the problem.

I did go through other sites and I did find scripts in other languages for the same issue, but I was not able to convert them to powershell or get the necessary component to run correctly … Like:

https://sqa.stackexchange.com/questions/9655/not-able-to-scroll-down-page-using-selenium-webdriver

https://intellipaat.com/community/16503/how-to-scroll-to-element-with-selenium-webdriver-using-c