반응형

Selenium 5

파이썬(Python) Selenium Click() 동작이 안될 때

예약 사이트를 자동화로 만드는 과정에서 몇 몇 버튼이나 a, href 링크들이 클릭이 안되는 경우들이 종종 있었다. element click intercepted ElementClickInterceptedException is not clickable at point 위 와 같은 메세지가 발생하거나 다운이되는 현상들이 있었다. 내가 예약사이트 자동화중에 만난 경우들을 아래와 같이 정리하고 해결 했던 방법도 정리해 보았다. Case 1 그림1과 같이 화면의 아래 김해CC를 클릭하고 날짜를 클릭 후에 예약하기 버튼을 눌러야 하여서 아래와 같이 코드를 짰다. kimhae_check = WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((B..

파이썬 Selenium 페이지 로딩 대기하는 방법

최근 웹 어플리케이션은 AJAX를 많이 사용한다. 즉, 페이지 전체를 로딩하는 것이 아닌 일부만 서버와 AJAX 통신을 하는 것이다. 그래서 브라우져에서 페이지를 로딩시 페이지에 element 들이 다른 시간대에 도착할 수 있다. 만일 페이지는 불렀고 우너하는 element가 아직 로딩 안된 상태에서 해당 위치를 selenium으로 찾으려고 하면 실패한다. ElementNotVisibleException 를 리턴해주게 된다. 셀레늄에는 두가지 방법으로 원하는 element가 로딩되는 시간을 기다려 준다. - Explicit Waits - Implicit Waits 1. Explicit Waits Explicit Waits 는 파이썬 개발자가 정한 조건이 될때까지 기다렸다가 되면 다음으로 진행한다. 조건문..

셀레늄(Selenium) id, name, xpath, link_text, partial_link_text, tag_name, class_name, css_selector 로 엘리먼트(elements) 찾기 및 실습

웹 페이지 element를 찾는 방법은 여러가지가 있다. 사용자는 셀레늄을 사용해서 가장 적절한 방법으로 찾으면 된다. Selenium 에서는 아래 방법들을 통해 element를 찾을 수 있게 도와 준다. - find_element_by_id - find_element_by_name - find_element_by_xpath - find_element_by_link_text - find_element_by_partial_link_text - find_element_by_tag_name - find_element_by_class_name - find_element_by_css_selector 여러개의 element를 리스트형의 리턴으로 받으려면 아래 방법을 사용하면 된다. - find_element_by_..

인스타그램 자동 "좋아요" 클릭 (like click) 파이썬

좋아요 자동 동작 코드를 보기 전에 자동 로그인과 자동 검색을 아래 링크서 먼저 확인하고 보는것을 추천한다. scribblinganything.tistory.com/20?category=943911 인스타그램 자동 로그인 (Instagram Log in) 코드>> 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 a.. scribblinganything.tistory.com scribblinganything.tistor..

인스타그램 자동 로그인 (Instagram Log in)

코드>> 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 import time def log_in(): options = webdriver.ChromeOptions() # options.headless = True options.add_experimental_option("excludeSwitches", ["enable-logging"]) # options.add_argument("user-agent=Moz..

반응형