What should the program do? Click on every Button on the site.
By bybut = By.XPath("//span[@class='Button']");
var element = driver.FindElement(bybut);
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
for (int i = 0; i < 99; i++)
{
// Scroll element into view (orange rectangle on my picture)
js.ExecuteScript("arguments[0].scrollIntoView(true);", element);
// Time for scrolling
System.Threading.Thread.Sleep(2000);
// Click on Button
driver.FindElement(By.XPath("//span[@class='Button']")).Click();
}
On the internet site, if you click on the button, it will be removed.
My Problem: If the For-Loop repeated, it comes to an error, because the next button is already in my view frame. How can I check, if a button is already into view?
Do you have any other solutions? Thanks in advance!
