I opened a new tab by clicking something in selenium in c #. I want to scroll after changing to a new tab, but I get a timeout error.
I get a timeout message and no scro
Please use the below code it will work fine
//Open link in new tab
Actions act = new Actions(driver);
act.KeyDown(Keys.Control).MoveToElement(elementToopenInNewTab).Click().Perform();
// Switch to new tab
driver.SwitchTo().Window(driver.WindowHandles.Last());
//Scroll down in new tab
IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
js.ExecuteScript("window.scrollTo(0, document.body.scrollHeight)");
//Move to first tab again
driver.SwitchTo().Window(driver.WindowHandles.First());