function myCustomFunction() { let song = $$('.css-tr3vhx'); for (let each of song) { if…
- User
function myCustomFunction() { let song = $$('.css-tr3vhx'); for (let each of song) { if (each.firstChild.length >= 9) { if (each.firstChild.substringData(7, 2) == "한국") { each.parentElement.firstElementChild.firstElementChild.firstElementChild.click(); var ss = ('.css-7zhfhb'); ss.nextElementSibling.click(); } } } ('.css-q9kfw1').click(); $('.css-1ciqeix').click(); } myCustomFunction();
으로 입력하니까
Uncaught TypeError: Cannot read properties of null (reading 'click') at myCustomFunction (:12:21) at :1:1 myCustomFunction @ VM118:12 (anonymous) @ VM123:1
으로 에러가 발생한다. 어떻게 해결할 수 있을까?
- Assistant
JavaScript에서 발생하는 이러한 오류는 일반적으로 지정된 선택기를 사용하여 DOM 요소를 선택하려고 시도했을 때 해당 요소가 존재하지 않아 을 반환하고, 이런 상태에서 함수를 호출하려고 하면 발생합니다.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.