selenium 에서 element를 찾을 수 없다고 나옵니다.

조회수 5130회

Ie webdriver를 이용하여 selenium 작업시 에러

에러 메세지

selenium.common.exceptions.NoSuchElementException: Message: Unable to find element with xpath == //li/a[@id='a_0111060000']

또는 다른 에러들 줄줄..

윈도우10 , 파이썬 3 ( in anaconda) 환경이며

IE 브라우저를 사용해야 합니다

작업 순서 :

http://www.hometax.go.kr 에 접속하여,

조회/발급 메뉴를 클릭하고,

근로소득간이세액표를 클릭하는 것 까지의 활동입니다.

이미지

이미지

제 코드는 이렇습니다.

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException

import os
import time
driver = webdriver.Ie()
driver.get("http://www.hometax.go.kr")

driver.find_element_by_xpath("//li[@id='group1299']").click()
time.sleep(2)

driver.switch_to_frame(driver.find_element_by_tag_name('iframe'))
time.sleep(2)
driver.find_element_by_xpath("//li/a[@id='a_0111060000']").click()

읽어 주셔서 감사합니다. 혹시 가능한 코드를 알려 주시면 정말 감사하겠습니다.

  • (•́ ✖ •̀)
    알 수 없는 사용자

1 답변

  • 해결 돼서 자답 합니다.

    코드에 문제가 있었던 것이 아니라 IE 드라이버가 32비트로 설치돼서 생긴 문제였네요..

    내 운영체제에 맞는 64비트 드라이버로 했더니 해결 됐어요.

    • (•́ ✖ •̀)
      알 수 없는 사용자

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)