본문 바로가기
IT/UITEST

UI-Test_03 submit

by dya0 2019. 5. 6.

구글에서 검색을 해보자




 
package ex1;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class Exam_09_google {
	public static void main(String[] args) {
		System.setProperty("webdriver.chrome.driver", "D:\\seleniumlib\\chromedriver.exe");
		WebDriver driver = new ChromeDriver();
		driver.get("https://www.google.com");
		WebElement inputSearch = driver.findElement(By.name("q"));
		//WebElement inputSearch = driver.findElement(By.id("q"));
		inputSearch.sendKeys("날씨");
		inputSearch.submit(); //구글의 경우 버튼클릭으로 검색하는 게 아니고 enter로 입력받기 때문에 submit()을 사용함
	}
}

'IT > UITEST' 카테고리의 다른 글

UI-Test-06 자바스크립트 함수 실행 방법  (0) 2019.05.06
UI-Test-05 iframe에 감싸져 있는 경우 해결 방법  (0) 2019.05.06
UI-TEST-04태그안의 값 가져오기  (0) 2019.05.06
UI-Test_02 선택방법  (0) 2019.05.06
UI-Test-01  (1) 2019.05.06