- 문제점
XPath로 엘리먼트를 찾았는데 엘리먼트를 selenium라이브러리가 인식하지 못하였음
- 원인
엘리먼트가 inputFrame으로 묶여있었기 때문.
기존 코드:
WebDriverWait wait = new WebDriverWait(driver, 5);
//5초 기다리고 찾기
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\"txt_simple_address\"]")));
WebElement address = driver.findElement(By.xpath("//*[@id=\"txt_simple_address\"]"));
executor.executeScript("\"arguments[0].value = '서울시'\"", address);
- 해결
driverWait을 시킬때, 스위치가 가능 하면 inputFrame으로 driver를 스위치 하도록 코드를 짬.
WebDriverWait wait = new WebDriverWait(driver, 5);
//5초 기다리고 찾기
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("inputFrame")));
WebElement driverWait = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\"txt_simple_address\"]")));
executor.executeScript("arguments[0].value = '서울시'", driverWait);
'트러블 슈팅' 카테고리의 다른 글
try with resources 사용 시 언어 수준 설정 (0) | 2023.06.13 |
---|---|
selenide 동작하는중 마주한 문제 (0) | 2023.06.07 |
다른 클래스타입의 리스트 복사하기 JAVA (0) | 2022.12.29 |
JAVA .split error (0) | 2022.12.17 |
flask로 만든 회원가입, 로그인페이지를 서버에 올리는 과정에서 발생한 오류 (0) | 2022.12.14 |