본문 바로가기

uitest6

Selenium을 이용한 UI TEST selenium을 이용해서 ui test를 하기에 앞서 https://www.seleniumhq.org/download/에 들어가자 필자는 자바를 사용할 것이므로 자바를 다운 받았다 다른 언어를 사용할 것이라면 해당 언어 맞는 것을 다운 받으면 된다. 그 다음은 아래로 내려가서 사용할 브라우저에 해당하는 드라이버를 다운 받는다. 필자는 크롬을 사용할 것이므로 크롬을 선택했다. latest로 다운 받았는데 항상 자신의 버전과 일치해야 하므로 구글 설정에 들어가서 업데이트를 해야 한다. 정보에 들어가면 알아서 최신 버전으로 업데이트를 해준다. 이제 이클립스에 들어가서 사용할 자바 프로젝트의 Build Path에 들어간다 위의 파일을 다 넣으면 Referenced Libraries에서 확인 할 수 있다. 2019. 5. 7.
UI-Test-09 select를 선택하는 3가지 방법 inputAge.selectByVisibleText("20대"); text로 선택하는 방법 inputAge.selectByIndex(3); index로 선택하는 방법 inputAge.selectByValue("5"); value 값으로 선택하는 방법 package ex1; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.Select; public class Exam_17_select { public static void main(String[] args) { System.setP.. 2019. 5. 7.
UI-Test-05 iframe에 감싸져 있는 경우 해결 방법 UITEST02 글에서 인터파크의 경우 추가로 코드를 더 써야 한다고 언급한 적이 있다. 인터파크의 경우 iframe 안에 로그인 페이지가 있어서 switchTo를 사용해서 iframe안으로 들어가야 한다. 그리고 인터파크의 경우 비슷한 아이피를 가진 여러 대의 컴퓨터가 동시 접근하면 한동안 block 당하기 때문에 추후에 실행화면을 같이 가져올 예정이다. 따라서 아래의 예시는 아직 미완성이다. 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.chro.. 2019. 5. 6.
UI-TEST-04태그안의 값 가져오기 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_10 { public static void main(String[] args) { // 크롬 드라이버 위치 지정 필수 코드 System.setProperty("webdriver.chrome.driver", "D:\\seleniumlib\\chromedriver.exe"); WebDriver driver = new ChromeDriver.. 2019. 5. 6.
UI-Test_02 선택방법 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_04 { public static void main(String[] args) { MyIDPW m = new MyIDPW(); //id pw 다른 클래스에 넣고 불러옴 //크롬 드라이버 위치 지정 필수 코드 System.setProperty("webdriver.chrome.driver", "D:\\seleniumlib\\chromedr.. 2019. 5. 6.
UI-Test-01 package ex1; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Exam_01 { public static void main(String[] args) { //크롬 드라이버 위치 지정 필수 코드 System.setProperty("webdriver.chrome.driver", "D:\\seleniumlib\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); //브라우저 첫 주소 작성 - get() 시작, close() 닫는다 driver.get("https://www.naver.com"); driver.close().. 2019. 5. 6.