-
Selenium Python button 클릭카테고리 없음 2020. 8. 20. 22:02
질문
내 시스템에서 내 button을 클릭하게하는 방법을 찾을 수 없습니다.여기에 button (또는 첨부 파일)의 코드가 있습니다.
<button class="btn btn-primary btn-captcha" id="invisibleCaptchaShortlink" type="submit">continue</button>
이 명령을 이미 시도했지만 작동하지 않습니다.
search = driver.find_element_by_name("invisibleCaptchaShortlink") search.click()
답변1
xpath 아래 사용 ::
driver.find_element_by_xpath("//button[@id='invisibleCaptchaShortlink'][contains(text(),'continue')]")
또는
driver.find_element_by_id("invisibleCaptchaShortlink")
find_element_by_id
를 사용해야하는 대신 유효하지 않은find_element_by_name
요소를 찾기 위해 xpath 위에 잘못된 전략을 사용하여 요소를 검색하려고합니다.출처 : https://stackoverflow.com/questions/61250670/selenium-python-click-a-button