Selenium5 [Selenium/Java] java.io.IOException : Server returned http response code: 403 for url 에러 첨부파일 형식이 아닌 일반 이미지를 다운받아야 해서 아래와 같은 함수를 만들었다. 이미지주소, 다운받을 경로, 이미지파일 이름을 매개변수로 넘겨주고 최종 저장된 이미지 파일(확장자포함)를 반환하는 함수이다. protected String downloadImage(String imgUrl, String downDir, String name) { try { URL url = new URL(imgUrl); URLConnection uc = url.openConnection(); InputStream is = new BufferedInputStream(uc.getInputStream()); FileOutputStream fos = new FileOutputStream(downDir+File.separator+n.. 2024. 1. 16. [Selenium/Java] 에러org.openqa.selenium.ElementNotInteractableException: element not interactable | click(), sendKeys(), executeScript() org.openqa.selenium.ElementNotInteractableException: element not interactable 존재하는 요소이지만 클릭이 안되는 경우 나타나는 에러이다. webElement = driver.findElement(By.cssSelector("#searchBtn > img")); // 기존코드 //webElement.click(); // 방법 1. //webElement.sendKeys(Keys.ENTER); // 방법 2. -> 해결 JavascriptExecutor jsx = (JavascriptExecutor) driver; jsx.executeScript("arguments[0].click;", webElement); 가장 흔하게 보이는 해결 방법은 cli.. 2023. 12. 12. [Selenium] 에러 org.openqa.selenium.ElementClickInterceptedException (is not clickable at point. Other element would receive the click) webElement.driver.findElement(By.id("searchBtn")); webElement.click(); org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element ... is not clickable at point (1309, 322). Other element would receive the click: ... 상황: 조회btn(searchBtn)을 click()하지 못하는 에러 element는 찾은 상태이지만 searchBtn으로 focus가 가지 못하는 경우 발생하는 에러이다. 왜냐하면 조회버튼을 눌러야 하는데 datepicker가 닫히지 않은 상태로 진행되어서 조회 버튼에 .. 2023. 12. 11. [Selenium] 자바 | WebDriverWait.until()와 ExpectedConditions WebDriverWait 웹 드라이버에 대기시간을 주는 객체 Selenium의 실행속도는 웹페이지 로딩 속도보다 빠르다. 때문에 element가 로딩될 때 까지 기다려야 하는 경우 사용한다. 예를 들어, 페이지 생성 버튼(더보기)을 누르기 위해 대기시간을 가져야 하는 경우 WebElement moreBtn = new WebDriverWait(driver, 10); 10초 대기 하겠다는 의미이다. WebDriverWait.until() 명시적 대기(Explict wait)라고 한다. moreBtn = new WebDriverWait(driver, 10) .until(ExpectedConditions.elementToBeClickable(driver.findElement(By.cssSelector(css)).. 2023. 12. 6. [Selenium] 에러 org.openqa.selenium.WebDriverException: unknown error: result.webdrivervalue.value list is missing or empty in runtime.callfunctionon response 프로젝트의 크롬드라이버 버전과 내 컴퓨터의 크롬드라이버 버전이 일치하지 않는 경우 발생하는 에러. 해결 1. 자신의 크롬 드라이버 버전 확인. (chrome 설정에서 확인 가능) 2. 해당 크롬 드라이버 버전을 구글에 검색해서 다운로드 3. 작업관리자에서 백그라운드 프로세스 chromedriver 돌아가는 것을 다 작업끝내기 하고 4. 기존 프로젝트의 크롬 드라이버 삭제하고, 다운받은 드라이버를 프로젝트에 넣기. * CrawlerContainer에 Collect파일들을 복붙하고 실행할 때 위와 같이 에러가 발생하는 경우 작업관리자에서 chromedriver.exe 작업을 끝내고 버전확인하기 ( browerDrv파일의 chromedriver.exe 파일 삭제 CrawlerItems의 chromedriver.. 2023. 12. 5. 이전 1 다음