반응형
# 요소 찾아 변수에 저장
element = wait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "찾을 요소")))
# JavaScript를 사용하여 요소를 클릭
driver.execute_script("arguments[0].click();", element )
wait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "찾을 요소" ))).click()
element1 = wait(driver, 10).until(EC.presence_of_element_located((By.ID, "down"))) #iframe 태크 엘리먼트 찾기
driver.switch_to.frame(element1) #iframe 진입
driver.switch_to.default_content() #iframe 나오기
# 일자 클릭: 활성된 날짜만 클릭되도록 대기
element_xpath = "찾을 요소"
# 기존 요소가 더 이상 유효하지 않을 때까지 대기
wait(driver, 10).until(EC.staleness_of(driver.find_element(By.XPATH, element_xpath)))
# 새로운 요소가 나타날 때까지 대기
new_element = wait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, element_xpath)))
# 새로운 요소 클릭
new_element.click()
element = wait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "찾을 요소" )))
# ActionChains를 사용하여 클릭
ActionChains(driver).move_to_element(element).click().perform()
반응형
'python3 selenium' 카테고리의 다른 글
python3 selenium 브라우저 팝업,탭 이동 (1) | 2023.11.19 |
---|---|
python3 selenium 동일한 요소 여러개 제어하기 (1) | 2023.11.18 |
python3 selenium ChromeDriver service, options (0) | 2023.11.17 |
pyinstaller, webdriver 콘솔창 안뜨게하기 (0) | 2023.09.19 |
캠핑장 예약 매크로, 캠핏 예약 매크로 (11) | 2023.09.13 |