I had used JavaScript-executer & was able to find the ImageElement
, But further when I try to extract the URL(for downloading the image.svg ), I am getting an error "NoSuchElementException ", below is my Code:
((JavascriptExecutor)driver).executeScript("window.open('https://www.lambdatest.com/selenium-automation/','_blank');");
wait.until(webDriver -> ((JavascriptExecutor) webDriver).executeScript("return document.readyState").equals("complete"));
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
JavascriptExecutor js = (JavascriptExecutor) driver;
By Image=By.xpath("//img[@title='Jenkins']");
js.executeScript("window.scrollTo(0, document.body.scrollHeight)");
// Below commented snippet is giving Error
/*WebElement ImageElemnt =driver.findElement(Image);
String src = ImageElemnt.getAttribute("src");
System.out.println(src);*/
wait.ignoring(NoSuchElementException.class).until(ExpectedConditions.invisibilityOfElementLocated(Image))