From ab9655c6b1088b9d47147760c62fa236a4acfb43 Mon Sep 17 00:00:00 2001 From: haen-su Date: Wed, 22 Nov 2023 15:34:53 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=81=AC=EB=A1=A4=EB=A7=81=20=EC=9E=91?= =?UTF-8?q?=ED=92=88=20=EC=A4=84=EA=B1=B0=EB=A6=AC=20=EB=8D=94=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20try/catch=20=EA=B5=AC=EB=AC=B8?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/api/work/service/CrawlingService.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/oven/server/api/work/service/CrawlingService.java b/src/main/java/com/oven/server/api/work/service/CrawlingService.java index 7dbd0d7..fa43c20 100644 --- a/src/main/java/com/oven/server/api/work/service/CrawlingService.java +++ b/src/main/java/com/oven/server/api/work/service/CrawlingService.java @@ -220,10 +220,15 @@ public void saveWork() { log.info("--------genre: " + genre.toString() + "--------"); // 줄거리 - WebElement moreButton = detailDriver.findElement(By.className("synopsis")).findElement(By.tagName("button")); - if(moreButton.isDisplayed()) { - ((JavascriptExecutor) detailDriver).executeScript("arguments[0].click();", moreButton); - log.info("--------더보기 버튼 선택--------"); + try { + WebElement moreButton = detailDriver.findElement(By.className("synopsis")).findElement(By.tagName("button")); + if(moreButton.isDisplayed()) { + ((JavascriptExecutor) detailDriver).executeScript("arguments[0].click();", moreButton); + log.info("--------더보기 버튼 선택--------"); + } + + } catch (NoSuchElementException e) { + } String summary = detailDriver.findElement(By.className("synopsis")).getText(); @@ -246,7 +251,7 @@ public void saveWork() { List moreButtons = detailDriver.findElements(moreButtonLocator); for (WebElement button : moreButtons) { - if (moreButton.isDisplayed()) { + if (button.isDisplayed()) { ((JavascriptExecutor) detailDriver).executeScript("arguments[0].click();", button); log.info("--------더보기 버튼 선택--------"); }