New answers tagged


This code is for scrolling to the full height of the page. It will scroll down to the end of the page: String jsCode1 = "window.scrollBy(0, document.body.scrollHeight)"; JavascriptExecutor je = (JavascriptExecutor)driver; je.executeScript(jsCode1); This is for scrolling in an upward direction. String jsCode2 = "window.scrollBy(0, -1000)"; je....


Finally, this solution works for me -- Instrument the Istanbul.js. Use Command - istanbul instrument test.js >> test-instumented.js Now, use the below code in @AfterClass annotation. It will execute the below method after all tests. 4. Now, we have coverage.json. Crete a HTML using coverage,json using istanbul report.


You can use Istanbul to instrument front-end code for code-coverage. Process looks something like this: Start application with code instrumented by coverage tool Run the Cucumber/Selenium tests against web-app instance Generate report of with coverage tool This article describes how you can use Istanbul to generate code-coverage from UI tests. This ...


WebElement extends TakesScreenshot, which means you can use getScreenshotAs on the WebElement directly. You can public void takeElementScreenshot(WebElement element) { driver.executeScript("arguments[0].scrollIntoView();", element); File screenshot = ele.getScreenshotAs(OutputType.FILE); //... } We can check if the element is in viewport ...

Top 50 recent answers are included