ChromeOptions option = new ChromeOptions();
		option.addArguments("headless"); // 헤드리스 모드, 창없이 내부적으로 처리
		option.addArguments("--blink-setting=imagesEnable=false"); // 페이지 로딩에서 이미지 제외
		WebDriver driver = new ChromeDriver(option);

import java.util.List;

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.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class Quiz02 {
	public static void main(String[] args)  throws Exception {
		System.setProperty("webdriver.chrome.driver", "chromedriver.exe");

		ChromeOptions option = new ChromeOptions();
		//		option.addArguments("headless"); // 헤드레스 모드, 창없이 내부적으로 처리
		//		option.addArguments("--blink-setting=imagesEnable=false"); // 페이지 로딩에서 이미지 제외
		//		WebDriver driver = new ChromeDriver(option);

		WebDriver driver = new ChromeDriver();
		WebDriverWait wait = new WebDriverWait(driver,10);
		JavascriptExecutor js = (JavascriptExecutor)driver;


		long startTime = System.currentTimeMillis();


		driver.get("https://front.wemakeprice.com/promotion/3693");


		List<WebElement> product_btns = driver.findElements(By.className("flag_wrap"));
		product_btns.get(0).click();
		//새 탭으로 이동 
		//팝업제어
//		driver.switchTo().window();
		
		


		List<WebElement> buy_btns = driver.findElements(By.className("btn_sys"));
		buy_btns.get(0).click();



		long endTime = System.currentTimeMillis();

		System.out.println( endTime - startTime );

		Thread.sleep(5000);
		driver.close(); 
	}
}

동작 시간 측정

		long startTime = System.currentTimeMillis();
        //     작업 수행 
        long endTime = System.currentTimeMillis();
		System.out.println( endTime - startTime );

이미지 로딩 제외

		ChromeOptions option = new ChromeOptions();
		option.addArguments("--blink-setting=imagesEnable=false"); // 페이지 로딩에서 이미지 제외
		WebDriver driver = new ChromeDriver(option);

헤드리스 모드

창없이 실행 , 고스트모드의 발전

		ChromeOptions option = new ChromeOptions();
		option.addArguments("headless"); // 헤드레스 모드, 창없이 내부적으로 처리
		option.addArguments("--blink-setting=imagesEnable=false"); // 페이지 로딩에서 이미지 제외
		WebDriver driver = new ChromeDriver(option);

팝업 창 제어

새탭 제어

 

'디지털 컨버전스 > Selenium' 카테고리의 다른 글

[Selenium] 타임딜  (0) 2020.04.22
[Selenium] 팝업창 제어  (0) 2020.04.22
[Selenium] iframe - 내게쓰기 입력  (0) 2020.04.22
[Selenium] 자바스크립트 입력 - 로그인  (0) 2020.04.22
[Selenium] 명시적 대기  (0) 2020.04.22

+ Recent posts