Posts

Blocking google_vignette ads using selenium and java

Image
Steps : 1.full page ads are block through JavaScript executor 2. We are using example website " https://automationexercise.com" 3. We are blocking ads on the product page Google vignette ads example : Sample of the code package com.demo; import java.util.NoSuchElementException ; import java.util.concurrent.TimeUnit ; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; public class GoogleAdsblock { static WebDriver driver ; @Test public static void blockads() throws InterruptedException{ System. setProperty ( "webdriver.chrome.driver" , "C:\\bin\\chromedriver.exe" ); driver = new ChromeDriver(); driver .get( "https://automationexercise.com" ); WebElement productBtn = driver .findElement(By. xpath ( "/...

How to open or handle the download page in multiple browsers using Selenium

Steps to handle download page 1.open browser 2. open website 3. download file 4. open new tab 5. load download page in the new tab 6. view the download file Code is implemented for the IEDriver IEDriver.java import java.time.Duration; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.WindowType; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.Test; public class IEDriver { static WebDriver driver; @Test public static void open() throws InterruptedException{ System.setProperty("webdriver.edge.driver", "C:\\Users\\Prashant\\Desktop\\Automation\\edgedriver_win64\\msedgedriver.exe"); driver = new EdgeDriver(); driver.get("https://www.selenium.dev/downloads/"); driver...