Skip to content

Commit

Permalink
Merge pull request #72 from oven-2023/feature/crawling
Browse files Browse the repository at this point in the history
fix: 크롤링 작품 줄거리 더보기 버튼 try/catch 구문 추가
  • Loading branch information
haen-su authored Nov 22, 2023
2 parents 466ad9e + ab9655c commit 6adff05
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -246,7 +251,7 @@ public void saveWork() {

List<WebElement> moreButtons = detailDriver.findElements(moreButtonLocator);
for (WebElement button : moreButtons) {
if (moreButton.isDisplayed()) {
if (button.isDisplayed()) {
((JavascriptExecutor) detailDriver).executeScript("arguments[0].click();", button);
log.info("--------더보기 버튼 선택--------");
}
Expand Down

0 comments on commit 6adff05

Please sign in to comment.