본문 바로가기

Python/selenium4

Python) 멀티프로세싱을 이용한 selenium 웹크롤링 # -*- coding: utf-8 -*- import sys import os import subprocess import time import multiprocessing from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.alert import Alert from selenium.webdriver.common.by import By from sel.. 2022. 2. 3.
selenium) 라디오버튼 값 얻기 .get_attribute # 1번 라디오버튼이 클릭 되어있는지 true or false radio_value = driver.find_element_by_xpath('xpath').get_attribute("checked") >>> print (radio_value) >>> true # value 값 얻기 radio_value = driver.find_element_by_xpath('xpath').get_attribute("value") >>> print (radio_value) >>> 1번버튼 2022. 1. 17.
selenium) 셀레니움 xpath 클릭 안될때 JavaScript 이용 방법 # 기본적인 방법 driver.find_element_by_xpath('xpath').click() # 자바스크립트를 이용한 방법 # 1. element = driver.find_element_by_xpath('xpath') driver.execute_script("arguments[0].click();", element) # 2. 자바스크립트 문법 & html id 이용 driver.execute_script("document.querySelector('#btnSearch').click()") 2022. 1. 17.
selenium) 셀레니움 기본 사용법 from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.alert import Alert from selenium.webdriver.support.select import Select from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import Select from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.. 2022. 1. 17.