removeAttribute
-
Selenium ReadOnly Remove Attribute프로그래밍 언어/Python 2021. 3. 18. 16:37
driver.execute_script( "document.getElementById('DateType').removeAttribute('readonly')") # readOnly 속성 제거 driver.find_element_by_xpath('//*[@id="DateType"]').send_keys( '2020-04-27') # 날짜 입력 이미지를 크롤링해서 후처리해야하는 일이 생겼는데 날짜를 기준으로 조회해야했다. 단순히 input type date 일 줄 알았으나 readonly 속성이 들어가있어 selenium 의 sendkey 메소드로는 값이 안들어감.. 찾아보니 자바스크립트로 특정 태그의 속성을 지울 수 있었고 이를 실행하는게 execute_script 메소드 readOnly 속성 제거 후 s..