글에 달린 디씨콘 종류 자동으로 읽는 프로그램 Python으로 만듬

손으로 하면

1. 디씨콘에 커서를 갖다댄다

2. 옆에 디씨콘 보기 버튼이 뜬다

3. 커서 디씨콘에서 벗어나면 버튼 사라져서(아마 1초일 거임) 그 전에 재빠르게 누름


driver.find_element_by_class_name("written_dccon").click()

driver.implicitly_wait(3)

driver.find_element_by_class_name('btn_dccon_infoview div_package').click()


written_dccon 클릭으로 디씨콘 보기 버튼 뜨는 거까진 확인함

근데 디씨콘 버튼 클릭할라 카면


Traceback (most recent call last):

    raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".btn_dccon_infoview div_package"}

  (Session info: chrome=84.0.4147.89)


이거 뜸 


html을 안 배워서 내가 구조를 파악 못 하고 있는 건가? 아님 다른 조치를 더 취해야 하나? 모르겠음



아래는 html 코드


<div class="comment_dccon clear">

<div class="coment_dccon_img">

<img src="https://dcimg1.dcinside.com/dccon.php?no=62b5df2...암튼 고유번호" class="written_dccon" alt="3" conalt="3" title="3" data-dcconoverstatus="true"> == $0</p>

</div>

<div class="coment_dccon_info clear dccon_over_box" onmouseover="dccon_btn_over(this);" onmouseout="dccon_btn_over(this);" style="display: none;" data-display="hide">

<span class="over_alt">3</span>

<button type="button" class="btn_dccon_infoview div_package" data-type="comment" onclick="dccon_btn_click();" reqpath="/dccon">디시콘 보기</button>

</div>

::after

</div>


여기서 5번째 줄의 style="display: none;" data-display="hide"는 디씨콘에 커서 갖다대면 style data-display="show"로 바뀜

중간에 style="opacity: 0.121213" 어쩌고 나오는데 그냥 서서히 나타나고 사라지는 거 표현하는 코드 같고