HTML & CSS

[49-2 Selenium] 현재 URL가져오기, current_url

Olivia-BlackCherry 2022. 10. 30. 12:55

셀레늄 기본 세팅이다.

from selenium import webdriver
from selenium.webdriver.common.by import By

URL ="https://instagram.com"
chrome_driver_path = "C:\developer\chromedriver.exe"

driver = webdriver.Chrome(executable_path=chrome_driver_path)
driver.get(URL)

 

현재 URL 가져오기 

current_url

current_url = driver.current_url
print(type(current_url))

>> 데이터 유형은 str (문자열) type이다.